Reputation: 764
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?
Upvotes: 1
Views: 60
Reputation: 40594
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.
Upvotes: 0
Reputation: 88345
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/
Upvotes: 2