Git merge allows us to perform fast-forward and no fast-forward branch merging. Any ideas when to use fast-forward merge and when to use no fast-forward merge?
Git merge allows us to perform fast-forward and no fast-forward branch merging. Any ideas
Share
The
--no-ffoption is useful when you want to have a clear notion of your feature branch. So even if in the meantime no commits were made, FF is possible – you still want sometimes to have each commit in the mainline correspond to one feature. So you treat a feature branch with a bunch of commits as a single unit, and merge them as a single unit. It is clear from your history when you do feature branch merging with--no-ff.If you do not care about such thing – you could probably get away with FF whenever it is possible. Thus you will have more svn-like feeling of workflow.
For example, the author of this article thinks that
--no-ffoption should be default and his reasoning is close to that I outlined above:Consider the situation where a series of minor commits on the “feature” branch collectively make up one new feature: If you just do “git merge feature_branch” without
--no-ff, “it is impossible to see from the Git history which of the commit objects together have implemented a feature—you would have to manually read all the log messages. Reverting a whole feature (i.e. a group of commits), is a true headache [if--no-ffis not used], whereas it is easily done if the--no-ffflag was used [because it’s just one commit].”