0

I am working at a place where we will have multiple versions of a product, each stored in their own branch. What is the proper methodology for merging a fix for a bug that might span multiple versions?

Also is branching the correct way to store multiple versions or should I somehow use tags? Sorry somewhat new to this advanced Git workflow.

Scott Weldon
  • 9,673
  • 6
  • 48
  • 67
Peter S
  • 351
  • 1
  • 3
  • 13

1 Answers1

0

Perhaps there are many ways to deal with it.
What I would do is to...

  1. Create a new branch from master and fix this bug.

    git checkout master
    git checkout -b bugfix
    //git add some fix files
    git commit -m "bugfix with a better commit message"
    git push origin/bugfix
    
  2. Merge into master.

    git checkout master
    git merge bugfix
    git push origin/master
    
  3. Everyone working on any other feature branches should:

    git checkout featureBranch
    //pull from master...
    git pull --rebase origin master
    
Grzegorz Górkiewicz
  • 4,496
  • 4
  • 22
  • 38
  • the only problem with this strategy is that the bug may not even exist in the master anymore. Lets say that from feature branch 2-6 the bug exists, but in no other, and we are now on 8. I know...its a tricky, and perhaps unanswerable problem. The answer might be, fix features 2-6 by hand. – Peter S Feb 06 '17 at 21:23
  • Then fix this bug on branch 2 and [cherry-pick it onto branches 3-6](http://stackoverflow.com/a/18529576/4280359). – Grzegorz Górkiewicz Feb 06 '17 at 21:28
  • Thank you Sir! If you want, submit that as an answer (or just update your current answer with that). I didnt know about the Cherry Pick command. – Peter S Feb 06 '17 at 22:15