How can I combine two non-sequential git commits into one? [duplicate]
If the following is a list of commits on a branch:
A - B - C - D
How can I combine commits A and C into (AC)?
(AC) - B - D
First do git rebase -i aaaaaa^
and then your text editor will show up looking like this:
pick aaaaaa
pick bbbbbb
pick cccccc
pick dddddd
Change it so that it looks like
pick aaaaaa
squash cccccc
pick bbbbbb
pick dddddd
and close it and git does the rest.
http://git-scm.com/docs/git-rebase
git rebase -i A^
edit them so that C
is after A
. Change the pick
to f
(fixup) and save.
精彩评论