I recently switched to a new employer where we work in much larger teams and we work with multiple developers on features. Following the workflow as described in Vincent Driessen's A successful Git branching model I'm a bit confused as to how to deal with merge/rebase when working on these shared features.
At my previous employer I would create my own (local) feature branches which I'd rebase daily from the master
. Over here it is common practice to publish the feature branch and pull in the changes from the others. Most All of my colleagues use the default git pull settings (which results in a merge, polluting the branch history with pull-merges). I personally prefer to use the pull.rebase = preserve
setting to keep the history clean but this might not work well with their method.
I'm quite confused as to what is the proper method of dealing with this. I am aware that I shouldn't rebase published branches so I'm looking for some feedback.
What is the proper way of doing this? I was thinking about creating a single branch per feature (feature-XXX
) and then have each developer create their own (local) branch from the feature branch(local-XXX
). They can do their work normally and then using --ff-only
merge their changes back into the feature-XXX
branch (after rebasing local-XXX
).
This leaves me wondering: how can I keep the feature-XXX
from going stale? Do I merge the master
back into it on a regular basis? Or do I rebase it from time to time? And what effect would that have on the branches of my colleagues?
Another Stackoverflow post mentions merge master
on a regular basis into feature-XXX
and only before the merge rebase it.