Git merging hotfix to multiple branches

后端 未结 4 1009
-上瘾入骨i
-上瘾入骨i 2021-02-01 16:48

I\'ve been trying to wrap my head around git branching models. I\'ve been looking at http://nvie.com/posts/a-successful-git-branching-model/ for some ideas and coming from Subv

4条回答
  •  孤街浪徒
    2021-02-01 17:36

    In the case, you are working on branch "4.0" and have to make a fix on "3.1", you may rebase "4.0" after you commit "3.1":

    Make sure you are on the feature branch 4.0:

    git checkout 4.0
    

    Save current work so you can check out other branch:

    git stash  
    git checkout 3.1  
    

    Do editing and commit:

    git commit -a -m "bug fix"  
    git checkout 4.0  
    

    Get back your changes:

    git stash apply  
    

    Change 4.0 so it branches of the current head of "3.1":

    git rebase "3.1"
    

提交回复
热议问题