inblog logo
|
programmer
    JavaGit

    Git - Rebase

    [Git] rebase(drop, squash, reword), reset 해보기
    Jan 02, 2024
    Git - Rebase
    Contents
    Rebase
    ⚡
    Git rebase를 활용하여 Git log를 체계적으로 관리할 수 있다.
     

    맨 처음 로그(init)는 수정불가

    notion image
     

    Rebase

    git rebase -i HEAD~3 // 최근 3개의 로그가 보임
     

    - reword 해보기

    notion image
    처음 일반 모드에서 입력 모드로 변경
     
    notion image
    위와 같이 수정 후 명령행 모드에서 저장 후 나가기 실행
     
    notion image
    입력 모드에서 로그인 꾀병부려서 퇴근 → 로그인 아파서 퇴근으로 수정 후 명령행 모드로 저장 후 나가기 실행
     
    notion image
    reword 완료
     

    - drop 해보기

    notion image
    pick → d로 수정 후 저장 후 나가기
     
    notion image
    삭제 완료
     
    git reflog // 모든 로그 보기(rebase된 것도 보여줌)
    해쉬코드 4자리를 외운 후 다시 삭제전으로 되돌리기(작성자의 해쉬코드는 fdc3)
    reset코드를 이용하여 되돌림
     
    notion image
    reset 완료

    -squash 해보기

    notion image
    위와 같이 수정 후 저장 후 나가기
     
    notion image
    위와 같이 나오는데 자신이 원하는 이름 하나만 남기고 다 삭제(일반 모드에서 dd 사용)
     
    notion image
    저장 후 나가기
     
    notion image
    squash 완료
     
    Share article

    programmer

    RSS·Powered by Inblog