What is the difference between git fetch and git pull?

In simple words, git pull is a combination of git fetch (only for current branch) and a git merge.

The git fetch command is used to downloads all changes from a remote repository into your local. Git fetch is useful for getting the latest files and commit available in a remote repository. Git fetch does not merge changes to your current branch.

The git pull command will fetch latest commits from your current branch only and automatically merge into your local. This can cause conflicts if multiple persons have modified same code/file, so need to take care before git pull.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.