Make an existing Git branch track a remote branch?

前端 未结 22 3030
执念已碎
执念已碎 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条回答
  •  星月不相逢
    2020-11-21 08:04

    For anyone who, like me, just wants to sync up your local branch name with the remote branch name, here's a handy command:

    git branch -u origin/$(git rev-parse --abbrev-ref HEAD)
    

提交回复
热议问题