less than 1 minute read

여러개 커밋을 한번에 묶기

$ git rebase -i HEAD~3

pick 7c65355 Task 1/3
pick 2639543 Task 2/3
pick d442427 Task 3/3

# Rebase 2260a88..d442427 onto 2260a88
#
# 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
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
pick 7c65355 Task 1/3
squash 2639543 Task 2/3
squash d442427 Task 3/3

다음과 같이 변경후에 저장한다.

저장하고 다시 vi 창이 나오는데

커밋 메세지를 다시 정하고 저장해준다.

Categories:

Updated: