How to squash (merge with next one) commit during rebase?
This is my pseudo tree:
I started interactive rebase from the root:
git rebase --root -i and set
edit command for all commits. Here is example:
e b83fa60 Initial content (A) e 9a82ddf Update license information (B) e fa8cb80 Rewrite readme (C) e 0525f07 Update email address (D)
Now I’ve stopped at B during rebase:
A---B---C---D (master) ^
At this point I want to “merge” or “squash” B with the next C commit. How can I do it?
One Solution collect form web for “How to squash (merge with next one) commit during rebase?”
git rebase --continue will stop you at the next
e commit which is C, then
git reset HEAD^ && git add . && git commit --amend will squash current(C) with previous (B). Although I would personally simply continue rebase and redo again with marking C as
f – much simpler and faster.