alexa
Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry

What is the Key Difference between git pull and git fetch

What is the Key Difference between git pull and git fetch

The Key Differences between Git Fetch and Git Pull:-

Always Keep in mind Git fetch and git Git pull are used to download new data from a remote repository. but, 

Git Fetch:- It is only downloading the new updates from the remote repository - but it will not integrate any of these new updates into your working files.

Command - $ git fetch origin

Git Pull:- git pull is used to update your current MAIN branch with the latest changes from the remote server. That pulls not only downloads new updates it also directly integrates them into your current working copy files.

Command - $ git pull origin master

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 remote-tracking branches under refs/remotes/<remoteAdd>/. This operation never changes any of your own local branches under, 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).

git pull is what you would do to bring a local branch up-to-date with its remote version, while also updating your other remote-tracking branches.

Bottom Line:

Git Fetch:

Git fetch is a command that allows you to download objects from another repository.

Git Pull:

Git pull is a command that allows you to fetch from and integrate with another repository or local branch.


192 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online