Tool/Github

[Github] Git - Rebase

goakgoak 2018. 10. 29. 01:52

merge 해야하는 이유

  • 나중에 정리

Rebase

  • merge를 완료했다는 통보를 받으면 브랜치 변경 및 작업 브랜치 삭제한다.

    git checkout 본인_아이디
    git branch -D 삭제할_브랜치이름
    ex) git checkout econo-sangeuni //브랜치 이동
    ex) git branch -D step0

  • merge한 저장소와 동기화하기 위해 저장소 주소 추가 (최초 한 번만)

    git remote add {저장소_별칭} base_저장소_url
    ex) git remote add upstream https://xxxxxxxxxxxxxx.git
    // 위와 같이 저장소를 추가한 후 전체 remote 저장소 목록을 본다.
    git remote -v

  • 저장소에서 자기 브랜치 가져오기

    git fetch upstream {본인_아이디}
    ex) git fetch upstream econo-sangeuni

  • 저장소 브랜치와 동기화하기

    git rebase upstream/본인_아이디
    ex) git rebase upstream/econo-sangeuni