Question

Let's say I create a new branch for a feature I'm working on. In the meantime, the rest of the programming team make significant changes to the master branch. How can I deal with the fact that my branch will start falling behind, making future merges difficult (almost impossible)? Do I just merge frequently? Or just create branches for small features at a time?

Was it helpful?

Solution

You should be merging the master back in with your branch.

Let's say you didn't merge the master back in. Eventually when you deliver your functionality on your branch it will be merged with master. There may be lots of conflicts, both textually but also functionally, that need to be resolved. Will the 'integration person' know how to resolve those conflicts? Probably not. If you do the 'integration' then you might as well deliver a clean branch - so do the merge onto your branch first.

You can merge the master back in with your branch frequently or only just prior to your delivery. It is up to you. Doing it frequently might upset your focus; doing it once might end up being a 'big bang'.

Because branching in Git is so painless, it is generally a good idea to create branches for small features, as you noted.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top