Information about git pull and git fetch differences

In few simple words, fetch gets the latest data, but not the code changes and not going to mess with your current local branch code, but pull get the code changes and merge it your local branch.


git fetch

It will download all refs and objects and any new branches to your local Repository. It updates your local copy of the repository but does not modify any files in the working directory. It simply makes sure that the cached info it has about the repository you fetched is up-to-date.

You fetch when you want to see any updates on the remote, but you don't want to immediately integrate any such changes into the current branch.


git pull

It will apply the changes from remote to the current branch in local. A 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. 

When you use pull, Git tries to automatically merge. It is context-sensitive, so Git will merge any pulled commits into the branch you are currently working on. pull automatically merges the commits without letting you review them first. If you don’t carefully manage your branches, you may run into frequent conflicts.

Want to know, how to delete a Git branch locally and remotely. Click below link

https://www.binkod.in/2021/08/deleting-git-branch-locally-and-remotely.html


Post a Comment

If you have any questions or concerns, please let me know.

Previous Post Next Post