Getting Git

A comprehensive video course from git init to Git Master.

init: git fetch

In this video we'll learn how to use git fetch.

When sharing your work, it's likely your local copy will get out of sync with a remote.

You can use git fetch to download the latest object in references from a remote.

However, it's important to understand that git fetch doesn't change your local copy.

Let's demonstrate this by running:

git fetch origin

From the output we see Git downloaded new information from the remote.

In this case, it detected a few new branches.

However, if we run git log --online --decorate --graph --all we see the origin branches are ahead of their local counterparts.

Again, git fetch only downloads the work from a remote, it doesn't actually update your local repository.

While you may not need to run git fetch very often, it's useful gathering new information for a remote and determining if your local copy is out of sync.