0

I have a gitlab server and git command on my computer.

I can create a local branch with:

git branch my_local_branch

I can push this branch on my server with:

git push origin my_local_branch

I can fetch other branches which are on the server with:

git pull another_branch

And i can push it after making changes on files.

So i do not understand what is git track command.

What can i do more with track feature that i cannot do with pull/push?

Samuel
  • 612
  • 2
  • 9
  • 25
Bob5421
  • 7,757
  • 14
  • 81
  • 175

1 Answers1

0

A 'tracking branch' in Git is a local branch that is connected to a remote branch. When you push and pull on that branch, it automatically pushes and pulls to the remote branch that it is connected with.

Use this if you always pull from the same upstream branch into the new branch, and if you don't want to use "git pull" explicitly.

You can find details here

Noor A Shuvo
  • 2,639
  • 3
  • 23
  • 48
  • But when using git push and git pull i am connected a local to a remote branch too ? – Bob5421 Apr 19 '19 at 13:21
  • If you have multiple remote, then you have to specify the remote name. That is, `git push ` . If you track , you will no longer specify the remote name. – Noor A Shuvo Apr 19 '19 at 13:35
  • Okay so you mean track works only if we have a single repository. push/pull is only needed if we have multiple remotes ? – Bob5421 Apr 19 '19 at 16:29