2

Suppose that I have several shared branches on my Git repository, for example: newfeature, experiment and gtkgui, and I share those branches in the origin repository. My team and I make some changes on all branches and push those changes into the origin repository. Later I detect a minor bug on the core code, I fix it and commit it to the master branch.

I need this fix to be available on the other three branches. What is the best way to do this? Do I need to merge the master branch into the other branches one by one and push them? Could git rebase help me?

2 Answers 2

1

The two solutions are topic branch and cherry-picking:
See "Git & Working on multiple branches".

Now I really don't recommend cherry-picking, which in your case would mean duplicating a set of commits all over the place (i.e. in different branches).

So as long as you make changes from the oldest branch that needs them, and merge forward, you are on the right track.

0

I'd just rebase the feature branches on the master when this happens (which I understand changes slowly, so that should not be a big deal). It also distributes resolving any ensuing inconsistency nearer the point in time where it arose (thus benefiting from a hot wet cache effect, hopefully). Or you could cherry-pick the change(s) into the feature branches, when merging later on git should notice the already applied changes and just omit them silently.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.