I find the site Visualizing Git Concepts with D3 very helpful to see how the tree will look when various git commands are done from various states.
Lets back track to the
Disabled mail delivery... commit.
The next commit was on the invitation branch done by Red as origin/master was merged into that.
Unfortunately teal was still on the master branch and did two commits on master -
Removed duplicate imports... and
Moved user routes... which were then merged into invitation again by red.
Now, you were also working on what you had locally as master and did the
adjust buildpath commit. However, when trying to push this some where it said that your master was out of sync with the remote - and it was. Master on remote was at
Moved user routes and thus you had to merge the remote back into what you had.
git merge also does a commit when it does its merge.
From the D3 link at the top, the git merge is very close to the state you had at the
adjust buildpath commit. Doing
git merge master in your tree is much like doing a
git merge dev in the D3 sandbox:
And then a
git merge dev brings us to:
e065536... is exactly like your
Merge branch 'master' of https://... in this case.
But what if you don't want to have those commits. Some people don't like them (personally, I do... but that is my preference).
Then, you are looking at
This will reapply the commits from one branch on another.
Note again the very similar structure as the merge example (note: I've checked out master rather than leave it on dev). And then a
git rebase dev brings everything into line without the additional commit.
Note that the commit
bb92e0e which was the old master head is now greyed out and the new master head is
decfd13 because the history is reapplied on top of what you have done.
There's a gotcha there. You are rewriting your local history when you do a rebase. If you have shared the state of your repo (pushing it to somewhere else) where commit
bb92e0e is out there, rebasing will confuse everyone. If you have to do a
git push --force, you're probably doing it wrong.
Note that when you do a
git pull, you are doing the commands
git fetch and
git merge - thus the additional commit. You can do a
git pull --rebase which will be a rebase rather than a merge for the second step (you can also tweak your git config to do this by default). You can play with this a bit in the D3 site 'git pull' example.
Note that the convention on your tree appears to be
merge rather than
rebase - it may be best to keep following that convention and just understand (and accept) where the commits are coming from.