I had a curious git behaviour today, and I want to ask if this is normal. Now, this is the situation (new commits are added to the bottom):
br1 br2
A
\
B
C
D
Now, when I make
git checkout br1
git merge --no-ff br2
It becomes like this (please read up to down; newest commit is 'E')
br1 br2
A
| \
| B
| C
| D
| /
E
OK.. Now, weird thing is; now I call "git status"; it says I'm 4 commits ahead of the remote branch. How is this happening? Shouldn't I be only one commit ahead?
And the peculiar thing is, when I check from the Stash (the Git Web UI, basically) it confirms this "4 commits" status and I see the same commits (B C and D) under "br1" and "br2" both...
I assumed when I used "--no-ff" parameters, the commits at "br2" (B C D) won't be copied to the "br1" and only merge commit created. Am I mistaken here?
Technically, the 4 commits are actually part of
br1. If you deletebr2, the commits will still be part ofbr1. The difference comes when you are resetting the merge commit. If you do a hard reset you will go back to the commit just before the merge commit i.e.E. This is especially useful when you want to rollback. So yes, you are four commits ahead, but as long as you are not resettingbr1, you should be fine.Also
-no-ffis not to stop git from copying the commits. It is to keep the commits separate from the tree ofbr1. That way you maintain a history of branches and the context in which the commits were made, rather than a mass of commits all related to different features