Getting Git

A comprehensive video course from git init to Git Master.

init: git pull


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

Once we've determined that our local copy is behind, either by using git fetch or being told, we can bring it back up to date with git pull.

Since it's unlikely the master branch became out of date while watching this video, we'll use git reset to simulate our local copy being behind.

So we'll just reset it back a few commits by running:

git reset --hard HEAD~3

Now if we run git log ––oneline ––decorate ––graph ––all we see our local master branch is now behind the origin/master branch.

To bring the master branch up to date, we can run:

git pull origin master

We see from the output Git pulled down some changes.

If we run git log again, we'll see our local master branch is back in line with origin/master.

Similar to the other commands in Part 4, you can use the shorthand of git pull.

However, I still prefer being explicit.

It's important to understand git pull is really two Git commands.

This first is git fetch followed by git merge.

As such, it's possible to receive a merge conflict or merge commit when running git pull.

We'll learn this as well as options to help prevent these scenarios in the Master video.