When I run git rebase -i HEAD~2, it lists 11 commits instead of 2. Why?
What I've done prior to this was:
- Checked out upstream/branchA
- Rebased my new local copy of branchA with master
- Tried to push my local branchA back to upstream
- Git complained that the branches were out of sync, and to first pull in upstream
- Pulled upstream/branchA into local branchA
- Pushed local branchA to upstream/branchA (success)
HEAD~2means "go back 2", it more specifically means "the first parent of the first parent", emphasis on "first" because there can be a second parent (or even more). 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.HEAD~2^2I guess? See here for more details ongit's relative commit notation.