How do I synchronize two branches in the same Git repository?

后端 未结 3 960
小鲜肉
小鲜肉 2021-01-31 03:03

Here\'s a common workflow hurdle I encounter often:

master is our \"stable\" branch

$ git status
# On branch master
nothing to commit (working         


        
3条回答
  •  南笙
    南笙 (楼主)
    2021-01-31 03:37

    If you don't need the branch around:

    If you've merged foo back to master, "git branch -d foo" to kill the topic branch, and then "checkout -b foo" in the future when you need to hack on it again.

    If you do need the branch around:

    You can rebase your topic branch against the master branch:

    git checkout foo
    git rebase master
    

    Or:

    git rebase master foo
    

提交回复
热议问题