In Git, how do you apply a commit of bug fix to the other newer branches?

后端 未结 3 570
花落未央
花落未央 2021-01-06 18:34

If I have a public Git repository that contains 3 branches like the following:

  (release-to-customerA)
      |
      U               (master)
     /                 


        
3条回答
  •  一整个雨季
    2021-01-06 19:04

    You don't need to rebase for this particular operation, cherry-picking is fine:

    git checkout release-to-customerB
    git cherry-pick U
    git checkout master
    git cherry-pick U
    

    Cherry-picking only creates new commits and does not rewrite history, so it's always safe even if you later push to another repository.

提交回复
热议问题