Git track remote branch - how to make an existing Git branch track a remote branch?
I know how to make a new branch that tracks remote branches, but how do I make an existing branch track a remote branch?
How do you set a local branch to track a remote branch?I know I can just edit the .git/config file, but it seems there should be an easier way.
local branch can track a remote branch using git-branch with long option --set-upstream-to= or short option -u . The command sets up branchname 's tracking information. If no branchname is specified, then it defaults to the current branch.
1. Update your local meta-data using the following command:
git fetch --all
2. Have a look at your remote and local branches using the following command:
git branch -a
3. Switch to the target branch, the one you want to link with the remote branch:
git checkout
4. Now you can link your local branch to a remote branch using the following command:
git branch --set-upstream-to
You can get the path using the following command:
git branch
A local branch can track a remote branch using git-branch with long option --set-upstream-to= or short option -u . The command sets up branchname 's tracking information. If no branchname is specified, then it defaults to the current branch.