Git: The difference between Pull and Fetch

I really appreciated how Greg Hewgill summarized the difference between the two Git functions “Pull” and “Fetch” on Stackoverflow:

In the simplest terms, “git pull” does a “git fetch” followed by a “git merge”.

You can do a “git fetch” at any time to update your local copy of a remote branch. This operation never changes any of your own branches and is safe to do without changing your working copy. I have even heard of people running “git fetch” periodically in a cron job in the background (although I wouldn’t recommend doing this).

A “git pull” is what you would do to bring your repository up to date with a remote repository.

Leave a Reply