1

I had forked a directory, cloned my fork, and then files were added to the origin directory that I now wanted on my computer.

To sync a forked directory, I read that I was supposed to do git fetch upstream. But this didn't work in my case. I ended up having to do git remote add XXX and then git pull XXX.

Can someone explain what the difference is between git pull and fetch?

user3436624
  • 715
  • 2
  • 8
  • 18
  • possible duplicate of [What are the differences between 'git pull' and 'git fetch'?](http://stackoverflow.com/questions/292357/what-are-the-differences-between-git-pull-and-git-fetch) – Andrew C Oct 16 '14 at 18:51

2 Answers2

2

When you fork a project, and clone your fork, the upstream remote is not created automatically. You have to create the upstream remote, using the git remote add command, then you should be able to use either git fetch upstream && git merge upstream/master, or git pull upstream master.

I think if you try your fetch again, it will work, now that you have your upstream remote.

https://help.github.com/articles/fork-a-repo/

Andy White
  • 86,444
  • 48
  • 176
  • 211
0

When you clone a repository with git clone, the remote that you get is called origin, not upstream. git fetch origin or just git fetch should have done the trick.

cmaster - reinstate monica
  • 38,891
  • 9
  • 62
  • 106