3

Does the git fetch command copy down the entire remote repository to my machine, or just the upstream of my current branch?

Mashmagar
  • 2,556
  • 2
  • 29
  • 38
  • git fetch fetches branches commits from origin, whithout doing merges. If you want to make a copy of a repo, use git clone. See answers on this question for further insights http://stackoverflow.com/questions/292357/whats-the-difference-between-git-pull-and-git-fetch – BigMike Apr 03 '13 at 14:08
  • 1
    Entire repository may not be the best description. Fetch will get all of the commits in all of the branches since your last fetch/clone. Any history you already have won't be copied down again. – Roman Apr 03 '13 at 14:30

2 Answers2

3

Yes, by default it fetches all 'named heads or tags' for the <repository> specified.

GoZoner
  • 67,920
  • 20
  • 95
  • 145
0

Depends on the options that you use. It can do both. It updates the repository with the data but doesn't merge the changes with your local. That would be with git pull or git merge. (git pull per the documentation is a git fetch followed by a git merge)

https://www.kernel.org/pub/software/scm/git/docs/git-fetch.html

Schleis
  • 41,516
  • 7
  • 68
  • 87