Git Fetch vs Git Pull
A fetch only downloads new commits and leaves your files alone. A pull downloads them and merges them in, in one step.
Git Fetch
Getting the new commits from the remote. Your own files stay just as they were.
To fetch is to download new commits from a remote. Git stores them as a separate copy, like origin/main, beside your branch. You can then look at what changed before you mix it in. Nothing in your working files moves until you merge or rebase. A fetch is always safe to run.
Git Pull
The team's new commits come down from the remote into your branch.
To pull is to bring new commits from a remote into your own branch. It is a fetch followed by a merge, done in one step. After a pull, your files match what the team has pushed. If you and someone else changed the same lines, you get a merge conflict to fix. Pulling often keeps those conflicts small.
In one line
- Git Fetch
- Getting the new commits from the remote. Your own files stay just as they were.
- Git Pull
- The team's new commits come down from the remote into your branch.