My team uses a feature-branch workflow with git.
I'd like to somehow config a git pull upstream branchname
from the upstream repo to always be git pull --ff-only upstream branchname
. Is that possible?
I'd also be happy if I could configure the entire upstream
repo to only allow --ff-only
pulls.
Details
Our main integration branch is develop
in the main upstream repo, with individual feature branches starting from develop, making their changes, and then raising pull requests to merge the feature branches back to develop.
The problem is that many of our developers are not as git-savvy as they should be, and they keep messing up their local repo's copy of develop
, so that it diverges from the upstream copy of develop
.
They don't notice this this divergence. They then create a feature branch from their borked develop
, and don't realize it until they raise their pull request, which suddenly brings in a ton of crap. If we're lucky, a savvy reviewer tells them to clean up their pull request by rebasing. But every now and then a messed up pull request gets merged back and that messes up our upstream history.
Workaround
My recommendation to these novice git-folks is to always use the --ff-only
option when pulling from upstream, to force their local develop
branch to remain a perfect copy of the upstream repo.
If their local copy of develop
has diverged from upstream, then the --ff-only
option will yell at them when they next try to pull. This yelling will force them to fix the real problem.
But they are git-n00bs and so they often don't even understand what I'm recommending, and just continue to mess things up.
I'll try all the appropriate carrot/stick motivational techniques (Humans! I know, right?), but if I could just somehow configure their local repos with --ff-only
training wheels, then my review burden will go down (and my devs will be forced to learn better git techniques).