페이지 트리

이 페이지의 이전 버전을 보고 있습니다. 현재 버전 보기.

현재와 비교 페이지 이력 보기

« 이전 버전 2 현재 »

Rebase는 커밋을 새로운 부모 커밋으로 옮기는 기능을 제공한다.

(경고) Push된 history를 rebase 하지 않도록 주의한다. 이 경우 history를 기반으로 작업하고있는 개발자들에게 영향을 주게된다.

다음 명령은 현재 working branch의 커밋을 <base> branch로 옮긴다.

git rebase <base>

git rebase의 기본 동작은 non-interactive이며, interactive mode (--interactive, -i)로 editor를 이용할 수 있다.

git rebase -i new-base-branch

editor 화면:

pick 2231360 some old commit
pick ee2adc2 Adds new feature
# Rebase 2cf755d..ee2adc2 onto 2cf755d (9 commands)
#
# Commands:
# p, pick = use commit (커밋 사용)
# r, reword = use commit, but edit the commit message (커밋 메시지 변경)
# e, edit = use commit, but stop for amending (커밋 수정을 위해 자동 수행 멈춤)
# s, squash = use commit, but meld into previous commit (이전 커밋에 포함)
# f, fixup = like "squash", but discard this commit's log message (이전 커밋에 포함)
# x, exec = run command (the rest of the line) using shell (명령 수행)
# d, drop = remove commit (커밋 삭제)

editor를 종료하면 선택한 명령이 일괄 수행된다.


  • 레이블 없음