That's exactly what you should expect from a merge. If you wanted to rebase and fast-forward, you could have done that instead and had a straight line.
Example:
Before the merge, you had this situation:
That is, the history of master
and branch
diverged. They share h
as a common ancenstor. When merging (via git merge branch
while on `master), you end up with a commit with two parents to unify that history:
If that's not what you wanted, you can undo that and get what you wanted by doing something like:
git reset --hard HEAD@{1} # or whatever commit matches 'j' to undo the merge
git checkout branch
git rebase master # incorporate 'i' and 'j' commits into 'branch'
git checkout master
git merge branch # this merge will be a fast-forward now
Which will give you the rebased linear history you seem to be looking for: