Difference between GIT Fetch and GIT Pull

Udemy Generic 728x90

Difference between GIT fetch and GIT pull

Difference between GIT Fetch and GIT Pull

Hello Readers,

We are already aware that .NET developers generally use TFS (Team Foundation Server) as a source control. However, GIT is also an awesome source control tool being used by many organizations working on Microsoft technologies these days.

Difference between GIT Fetch and GIT Pull #sourcecontrol #git #tfs #fetch #pull Click To Tweet

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Difference between GIT Fetch and GIT Pull

Difference between GIT Fetch and GIT Pull

Let’s now look at very fine but important differences between “fetch” and “pull”.

Fetch

Git Fetch only downloads new data from a remote repository – but it doesn’t integrate any of this new data into your working files. Fetch is great for getting a fresh view on all the things that happened in a remote repository.

Due to its harmless nature, you can be assured that fetch will never manipulate, destroy, or screw up anything. This means you can never fetch often enough.

Pull

Git Pull, in contrast, is used with a different goal in mind: to update your current HEAD branch with the latest changes from the remote server. This means that pull not only downloads new data but also directly integrates it into your current working copy files.

This has a couple of consequences:

  • Since “git pull” tries to merge remote changes with your local ones, a so-called “merge conflict” can occur. 
  • Like for many other actions, it’s highly recommended to start a “git pull” only with a clean working copy.
  • This means that you should not have any uncommitted local changes before you pull. Use Git’s Stash feature to save your local changes temporarily.

Microsoft Corporation

What do you think?

Dear Reader,
If you have any questions or suggestions please feel free to email us or put your thoughts as comments below. We would love to hear from you. If you found this post or article useful then please share along with your friends and help them to learn.

Happy Reading!