a blog for those who code

Friday 20 June 2014

Git Pull Vs Fetch

In this post we will be learning about the basic differences between Git Pull and Git Fetch.Before we start we should be familiar with Git Pull as well as Git Fetch and also Git Merge.

Git Pull : This command is used to bring all the changes from the remote repository to the current branch in your local machine.

Git Fetch : In simple words, it downloads the objects and references from another repository. Git Fetch can fetch the changes from single repository or more than one repository.

Git Merge : This git command joins more than one development histories together. In simple words this command makes your local repository in sync with your remote repository.

So now, the difference between Git Pull and Git Fetch is that git pull automatically merges the commits into the branch you're in when you make the request whereas git fetch does not merges the commits to the current branch, it just creates a local copy of a remote branch.

So in simple words we can say that git pull does a git fetch and then git merge. Git Pull is high level command of git fetch and git merge. You can use any one of those, both are same.

Please Like and Share the Blog, if you find it interesting and helpful.

No comments:

Post a Comment