What is the difference between 'git pull' and 'git fetch'?

#13
by osanseviero HF staff - opened

Question:

What is the difference between 'git pull' and 'git fetch'?

Answer:

There are a few differences between git pull and git fetch.

git pull

The first one, git pull, is what you do when you want to update your local repo to match the remote one.

git fetch

The second one, git fetch, is what you do when you want to update your local repo to match the remote one, and update your local repo with a branch that has been added to the remote repo.

So if you’re on a branch, and the remote has an update, git pull will do

Sign up or log in to comment