Only Allow Git Fast-forward Merges to Avoid Ugly...
Only Allow Git Fast-forward Merges to Avoid Ugly Merge Commits
No one likes merge commits, they add noise to git history logs without really helping to convey what exact changes have occurred.
Usually these types of commits can be avoided by keeping feature branches up to date with git –rebase. When two branches have a direct common history, merges can be applied using the fast-forward strategy avoiding the need for a stitch-things-together merge commit.
Because the commit pointed to by the branch you merged in was directly upstream of the commit you're on, Git moves the pointer forward. To phrase that another way, when you try to merge one commit with a commit that can be reached by following the first commit's history.
http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging
To ensure you've kept your branches synced up with rebase and to avoid accidentally creating a merge commit, you can set git merge to only perform fast forward merges.
$ git config --global merge.ff only
This way, you'll get a gentle reminder to rebase. If that's not feasible then you can force through the merge with
$ git merge --no-ff
Read full article from Only Allow Git Fast-forward Merges to Avoid Ugly...
No comments:
Post a Comment