Make an existing Git branch track a remote branch?

前端 未结 22 3033
执念已碎
执念已碎 2020-11-21 07:16

I know how to make a new branch that tracks remote branches, but how do I make an existing branch track a remote branch?

I know I can just edit the

22条回答
  •  Happy的楠姐
    2020-11-21 08:01

    You might find the git_remote_branch tool useful. It offers simple commands for creating, publishing, deleting, tracking & renaming remote branches. One nice feature is that you can ask a grb command to explain what git commands it would execute.

    grb explain create my_branch github
    # git_remote_branch version 0.3.0
    
    # List of operations to do to create a new remote branch and track it locally:
    git push github master:refs/heads/my_branch
    git fetch github
    git branch --track my_branch github/my_branch
    git checkout my_branch
    

提交回复
热议问题