How can I update my local branches

I have several branches in my repository, and I find that over time it becomes increasingly difficult to keep them updated on the latest developments. I can always be sure that the wizard is updated because it is easy to remember, and I believe that my SVN mentality is still delayed.

  • master
    • bugfix1
    • bugfix2
    • newfeature
      • experiment

My problem is something like this. I make changes to the bugfix2 branch, I merge the changes to master as soon as I execute my commit, but then I have several other branches obsolete. I have to manually merge bugfix2 into each other branch. As my list of branches grows, I find it unrealistic to perform all of these merge operations.

Is there a team for this or is my workflow wrong?

+4
source share
3 answers

A common workflow is to combine with the most specific branch into a less specific branch.
But for an error that needs to be reported about all other branches , a simple merge with other branches is enough and can be written in a script (even with an alias):

for i in $branches; do git checkout $i git merge bugfix2 done 
+2
source

My advice is to combine everything you need into any branch that you are currently working on, and don’t worry about keeping others informed until the next time you work on them. One of the reasons I use git locally on top of my company’s centralized VCS is because it allows branches to become a little dated. An error that is difficult to reproduce may work against the exact version that was reported. New features can be debugged without wondering if this change was the cause of the problem or update that you just removed to push off a separate fix. By all means, don’t let your branches go too far from master , but don’t be religious to keep them always up to date “just because”. Update them at the best time for a separate branch.

+1
source

My suggested workflow was to reinstall bugfix branches to master as soon as the wizard continued. Thus, your story remains clear and does not contain as many compromises.

-1
source

All Articles