When I run git rebase -i HEAD~2
, it lists 11 commits instead of 2. Why?
What I've done prior to this was:
When you find "extra" commits like this that means there's a merge commit (a 2nd parent) in the mix and you're including the commits on both sides of the merge.
The Rebase Option This moves the entire feature branch to begin on the tip of the main branch, effectively incorporating all of the new commits in main . But, instead of using a merge commit, rebasing re-writes the project history by creating brand new commits for each commit in the original branch.
It depends on how your git
tree looks like. A "merge" commit for instance can have two or more parents. Depending on this, your commit can have multiple grandparents.
You probably need to rebase with
git rebase -i HEAD^1^2 git rebase -i HEAD^2^1 git rebase -i HEAD^2^2
(one of these three).
See here for more details about git
's relative commit notation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With