![[Git] Rebase](https://image.inblog.dev?url=https%3A%2F%2Finblog.ai%2Fapi%2Fog%3Ftitle%3D%255BGit%255D%2520Rebase%26logoUrl%3Dhttps%253A%252F%252Finblog.ai%252Finblog_logo.png%26blogTitle%3DCoding_study&w=2048&q=75)
Contents
log 관리로그를 정리하는 것
환경 셋팅하기





log 관리
- 특정 log 삭제하는 법
git rebase -i HEAD~3 // 헤드가 보는것부터 3개를 뽑아옴
첫번째 commit log는 건드릴 수 없음
# : Vi의 주석


git relog // 삭제된 내역 확인

$ git reset --hard 해시코드//내역 복원

에러log를 보고 MASTER뒤에 REBASE가 있을 때
git rebase --abort // ROLLBACK 할 때 사용 - rebase 취소
git rebase --continue // 수정 완료후 컨펌해주는 것
git rebase --edit-todo // edict 모드로 들어가서 수정할 때 사용
응답이 없으면 잘 된 것
- REWORD : 이름을 바꾸는 방법
i : insert 모드 > pick만 수정 > esc > 일반 모드 > :wq
일반모드 dd > i > 수정 > esc > :wq


- SQUASH : 여러 개의 로그를 하나로 만드는 법
찌그러뜨리는 log들이 최신 log여야 함

i : insert 모드 > pick만 수정 > esc > 일반 모드 > :wq
일반모드 dd > i > 수정 > esc > :wq

#은 무시해도 됨 → 중요한 것은 로그가 3개 있음

dd를 이용하여 s로 변경한 log들 이름을 삭제하고 pick의 log만 남겨둠

esc > 일반 모드 > :wq


Share article