The git merge
command has an option to perform fast-forward merge, but this is not what I want, because if it can't do a fast-forward merge, it uses the normal merge.
Is there a git command which only performs a fast-forward merge (from the tracked remote branch) and does nothing if the fast-forward merge is not possible?
No Fast-forward Merge Typically, this is when maintaining a definite branch topology. For doing so, the --no-ff parameter can be passed with the git merge command. Resultantly, the git merge command will construct a commit merge rather than fast-forwarding.
Note that merge conflicts will only occur in the event of a 3-way merge. It's not possible to have conflicting changes in a fast-forward merge.
Fast-forward merges literally move your main branch's tip forward to the end of your feature branch. This keeps all commits created in your feature branch sequential while integrating it neatly back into your main branch.
As stated above, Git's default is to use fast-forward merge. It will take the commits from the branch being merged and place them at the tip of the branch you're merging into. This creates a linear history, which is also the main advantage of using fast-forward merge.
From the git-merge
man page:
--ff-only
Refuse to merge and exit with a non-zero status unless the current HEAD is already up-to-date or the merge can be resolved as a fast-forward.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With