💻 Tech
In git, you can configure your git pull
to only allow fast-forward merge by setting this
[pull]
ff = only
A fast-forward merge happens when the branch being merged has a linear history with the branch it is being merged into. git pull
under the hood is a git fetch
followed by a git merge
. Now, if a “true merge” happens, git pull
is aborted. A “true merge” happens when there are divergent commits between the two branches. In turn, this maintains a cleaner and linear history.