Reputation: 21443
Here's my current log, from most recent commit to least recent:
E I want this message
D I don't want this message
C Don't want this message
B Don't want this message
A Want this commit separately
I want to squash commits B-E into a single commit, and keep commit A separate, so that it looks like this:
F I want this message
A Want this commit separately
Where F
contains all changes from B
through E
. I've tried this:
git rebase -i A
pick A Want this commit separately
reword B I want this message
fixup C
fixup D
fixup E
It prompts me for a commit message, auto-populating the existing message from commit B
, then it fails, saying You asked to amend the most recent commit, but doing so would make it empty.
How can I get the history I want?
Upvotes: 0
Views: 227
Reputation: 13589
From another question:
You may be able to:
git commit --allow-empty
git rebase --continue
git rebase -i HEAD~~
# fixup or remove second (empty) commit
Upvotes: 2