Make an existing Git branch track a remote branch?

前端 未结 22 3804
执念已碎
执念已碎 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 07:52

    For Git versions 1.8.0 and higher:

    Actually for the accepted answer to work:

    git remote add upstream 
    git fetch upstream
    git branch -f --track qa upstream/qa
    # OR Git version 1.8.0 and higher:
    git branch --set-upstream-to=upstream/qa
    # Gitversions lower than 1.8.0
    git branch --set-upstream qa upstream/qa
    

提交回复
热议问题