git merge --ff-only origin/main

Category: Git - Core

git merge --ff-only origin/main

Merge only if it can fast-forward

Merges the remote branch only when the merge is a pure fast-forward with no divergence, and aborts with an error otherwise. The flag makes the merge safe and predictable for scripted updates. If it fails, decide between a real merge or a rebase.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.