git commit 하나로 합치기

Eungi Kim·2020년 10월 23일
1

git rebase -i HEAD~N

'-' 가 아니라 '~' 이다. 현재 commit으로부터 N개의 commit에 대해 commit 합침, 제거, 메세지 수정 등이 가능하다.

pick 된 커밋들 중 조건에 맞게 수정하면 된다.

$ git rebase -i HEAD~2
pick 004644d first commit
pick ae53bdf second commit

# Rebase f42adb4..ae53bdf onto f42adb4 (2 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
#
# 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

https://cjh5414.github.io/git-rebase/

profile
Run and gun and debugun

0개의 댓글