0

I understand that git fetch downloads the data from the remote repository and only updates the remote-tracking branches, not yet merging into the local branches (thic can be done with git merge local_branch origin/remote_branch). And that git pull does all of this at once.

But I want to know: do both of these command download a single branch? Or do they download the entire remote repository (and in the case of git pull, merge it) at once?

Aviv Cohn
  • 15,543
  • 25
  • 68
  • 131
  • Take a look at this: http://stackoverflow.com/questions/292357/what-are-the-differences-between-git-pull-and-git-fetch – Mindastic Jul 04 '15 at 17:15

1 Answers1

2

git fetch fetches all branches and tags from the remote repository (but as you say, it does not merge the changes into local branches).

git pull does this fetch (of all branches and tags) and then merges only the current branch.

Luboš Turek
  • 6,273
  • 9
  • 40
  • 50
  • It fetches them all by default, but you can have it fetch anything you want by changing the default in `remote.$name.fetch` or explicitly on the command line. – jthill Jul 05 '15 at 16:31