Git – Auto-merging from master to all branches — good or bad idea

gitversion control

A question has surfaced on the team: would it be a good or a bad idea to have a script auto merge from master to all this release's branches on a daily basis?

I'm not entirely convinced by it — it seems that merging may yield conflicts (and in that case the script would back-off), but even if it doesn't, I can imagine cases where I'm working on some huge refactor on my branch, by some reason I want to commit and push it and then it may so happen that I can't because the master has been changed in-between! In those (rare) cases I would be left with no option than to git push --force or simply not push my changes.

What's your take on this? Are teams using these kinds of scripts elsewhere?

Thanks

Best Answer

My gut tells me I wouldn't do it. The issues probably outweight the benefits:

  • conflicts
  • not wanting to merge yet
  • rollbacks accidentally overriden by the script
  • wanting to merge two branches in a particular order
  • ...

In the trivial cases of simple merges without conflicts, doing it manually takes a couple of seconds anyway. And in the other cases, a script probably can't help.