Clutch
Clutch

Reputation: 7600

Git creates a merge commit although it performs a fast-forward merge

I'm merging a hotfix branch into master. When I do a simple git merge hotfix-2.09 the merge fast-forwards but I'm getting a 'merge branch "hotfix-2.09"' commit in the log. hotfixes 01 - 08 did not do this. Am I doing something wrong with this merge or did the state of my master change some how?

edit I guess this is not really a fast forward but acting like it.

[webapps@Staging www]$ git merge hotfix-2.09
Auto-merging includes/processOrderFunctions.php
Merge made by recursive.
 includes/processOrderFunctions.php |   38 +++++++++++++++++++++++++++++++----
 processorderPL.php                 |   29 ++++++++++++++++++---------
 2 files changed, 52 insertions(+), 15 deletions(-)

Upvotes: 1

Views: 412

Answers (2)

James Gregory
James Gregory

Reputation: 14223

Are you sure it fast-forwarded? You wouldn't get a merge commit if it did.

By the sounds of it, you're merging multiple hot-fixes into a branch. I assume these hotfix branches were created from the same point in time (master) and are not cumulative? (i.e. they all branched from master, not hotfix-2 from hotfix-1 etc...).

Then the first branch merged would fast-forward, because the parent-ref of the commits would match up to master. When you merged your second branch, its parent-ref would be pointing to the original HEAD of master and not the new one. This means it can't be fast-forwarded, because it's not a linear path, and this would require a merge to "flatten" the trees.

Upvotes: 2

Stefan Kendall
Stefan Kendall

Reputation: 67832

Did you rebase hotfix-2.09 to master before doing the merge?

Upvotes: 0

Related Questions