The local git branch can track the remote branch, which means that the w2> push and git commands will know to pull and pull the commits to and from the tracked branch by default. Also, git status will indicate the status between your current local branch and the remote branch that it is tracking. When you clone a git repository, git will add a tracking link to the local branch of the wizard to track the remote main branch. When you check out a new branch of remote access, git will add a tracking link to the created local branch to track the remote branch that you checked.
However, if you create a new branch locally and then paste it into the remote repository, you need to explicitly specify git if you want your local branch to start tracking the new remote branch. You do this with the -u or --set-upstream option when pushing the local branch to the remote repository: git push -u origin my-new-branch .
You can check which remote branches are tracking your local branches (if any) with the git branch -vv command The following is a small sample output.
b1 560eb64 Added file.txt b2 560eb64 [origin/b2] Added file.txt b3 b638c18 [origin/r1: ahead 1] Added file3.txt * master 560eb64 [origin/master] Added file.txt
In this case, we have local branches master , b1 , b2 and b3 . In the master branch, the remote branch named master is tracked, branch b1 does not track the remote branches, branch b2 tracks the remote branch named b2 , and branch b3 tracks the remote branch named r1 . git branch -vv also shows the status of the branch associated with the branch being tracked. Here, branch b3 is 1 commit ahead of the tracked remote branch, and the rest of the branches are updated with the corresponding remote tracked branches.
So, if you create a local branch and click on the remote repository, do you want to add a tracking link to the branch or not? Usually, when you push a new local branch to a remote repository, you do this to collaborate with other developers in this function. If you add a tracking link to your local branch, you can easily extract the changes that other people have made to the branch, so I would say that in most cases you want to add a tracking link.
Hemaolle Jan 18 '16 at 19:00 2016-01-18 19:00
source share