What is the difference between git fetch and git pull?

git pull is git fetch followed by git merge.

git fetchgit pull
Downloads new commits from the remoteDownloads and merges them into your current branch
Your files and branch do not changeYour files and branch change
Safe, you can review first with git log HEAD..origin/mainCan create a merge commit or a conflict
Works for all branches (--all)Works for the current branch

Use fetch when you want to see what changed before merging, and pull when you just want to update your branch. See Git Fetch and Pull.


Learn more about the similar topics:
Tutorials
Git Clone
Git Remote
Git Push
Git Fetch and Pull
Exercises & Assignments
Clone a repository, make a change and push it
Get new changes from the remote with fetch and pull
Interview Questions & Answers
What is Git Clone and How to Clone a Git repository?
How can you push changes to a remote branch in Git?
What is the difference between git fetch and git pull?
What is the difference between git clone and fork?
What is origin in Git?
What is a pull request?
What is the difference between force push and force with lease in Git?