Git track remote branch - how to make an existing Git branch track a remote branch?

348    Asked by anurhea in Devops , Asked on Feb 20, 2021
Answered by anu rhea

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



Your Answer

Interviews

Parent Categories