Fiddly git tricks
Git. Let us enforce some simple rules. We always want merges to our main branch to be complete merge commits, with reference to the source branch, but we want to avoid such back into dev branches.
Remembering to always apply the proper --no-ff
or --ff-only
flags on the fly is, well, unreliable. Can we automate this?
All we need is a way to pick which behavior we want based on the active branch:
[includeIf "onbranch:main"]
path=config.main
[includeIf "onbranch:*-dev"]
path=config.dev
And to define those behaviors:
[merge]
ff = no
[pull]
# pull uses merge, but should be able to do as it pleases
ff = yes
[merge]
ff = only