inblog logo
|
Coding_study
    Git/Github

    [Git] Rebase

    yuzu sim's avatar
    yuzu sim
    Jan 02, 2024
    [Git] Rebase
    Contents
    log 관리
    로그를 정리하는 것

    환경 셋팅하기


    notion image
    notion image
    notion image
    notion image
    notion image

     

    log 관리

    1. 특정 log 삭제하는 법
    git rebase -i HEAD~3 // 헤드가 보는것부터 3개를 뽑아옴
    첫번째 commit log는 건드릴 수 없음
    # : Vi의 주석
     
    notion image
    notion image
     
    git relog // 삭제된 내역 확인
    notion image
     
    $ git reset --hard 해시코드//내역 복원
    notion image
     
    에러log를 보고 MASTER뒤에 REBASE가 있을 때
    git rebase --abort // ROLLBACK 할 때 사용 - rebase 취소
    git rebase --continue // 수정 완료후 컨펌해주는 것
    git rebase --edit-todo // edict 모드로 들어가서 수정할 때 사용
    응답이 없으면 잘 된 것
     
    1. REWORD : 이름을 바꾸는 방법
      1. i : insert 모드 > pick만 수정 > esc > 일반 모드 > :wq
        일반모드 dd > i > 수정 > esc > :wq
        notion image
    notion image
     
    1. SQUASH : 여러 개의 로그를 하나로 만드는 법
    찌그러뜨리는 log들이 최신 log여야 함
    notion image
     
    i : insert 모드 > pick만 수정 > esc > 일반 모드 > :wq
    일반모드 dd > i > 수정 > esc > :wq
    notion image
     
    #은 무시해도 됨 → 중요한 것은 로그가 3개 있음
    notion image
     
    dd를 이용하여 s로 변경한 log들 이름을 삭제하고 pick의 log만 남겨둠
    notion image
     
    esc > 일반 모드 > :wq
    notion image
    notion image
     
    Share article

    Coding_study

    RSS·Powered by Inblog