Articles

The Difference Between Git Pull and Git Fetch

The main difference between git pull and git fetch is that git pull first does a git fetch and then does a git merge. So it's an automatic fetch-and-merge.

A plain old git fetch on the other hand just updates all remote tracking branches without modifying your working copy. A git fetch is pretty safe to run because it doesn't change anything locally apart from getting the latest upstream changes ready to be merged, without actually merging them.

Or as the Git documentation on git pull says:

In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD.

Hosted Gitea is a fully managed Gitea hosting service. If you're looking for a private alternative to GitHub or Gitlab check out our service.

Get your Gitea server