Git: setting a local branch’s upstream tracking branch

Posted on In QA

How to set a local branch’s upstream tracking branch in git? For example, I want to track remote repository ‘origin’ ‘s branch ‘demo’ with the local ‘demo’ branch.

You can set tracking information for the current branch (say cur_branch) of upstream branch (say also cur_branch) in remote repository origin with:

git branch --set-upstream cur_branch origin/cur_branch

Leave a Reply

Your email address will not be published. Required fields are marked *