Create a track (track) from a local branch to a remote branch


Today I downloaded a branch from the remote repository, and when I went to see information about the branches, I realized that the branch track was not created in local with the branch of the remote repository, and the information showed like this:

$ git branch -vv
master               58951259 [origin/master] commit1
develop              12345687 [origin/develop] commit2
features/feature-25  12345678 commit3

The tracking (track) of the branch has not been created. I wanted to have the follow-up done (I thought it was done only by default), since later you can see the commits that go ahead (ahead) and behind (behind) the remote branch.

asked by RodriKing 16.08.2017 в 18:54

1 answer


If you have a branch in local and want to track the branch, use the command:

git branch -u <nombre remoto>/<nombre rama remota> <nombre rama local>


git branch -u origin/feature#15 feature#15

When you bring a branch from the remote you should follow up alone but to make sure we can add the - track option to bring you the branch:

git branch --track nombre-rama origin/branch-name

When you create a branch in local and you want to upload it to the remote and that the branch is tracked (trak) we can do the git push with the option -u (shortcut of --set- upstream). It is uploaded and the tracking is created.

git push -u origin <nombre-rama>
answered by 18.08.2017 / 19:48