Pulling from a Git remote
Tags: video, git, podcast
Published: 2018-08-29 06:31:28

---
title: Pulling from a Git remote
canonical_url: https://zellwk.com/blog/pulling-from-a-git-remote
tags: video, git, podcast
description: When you make a change to a local repository, you can push a change to a Git remote. Likewise, when the remote gets changed, you can pull the changes back to your local repository.
published: true
---

{% youtube 6x7CGpEKUXo %} 

Note: This the fourth video in the Git for beginners series. [Watch the first video here](https://zellwk.com/blog/setting-up-git).

When you make a change to a local repository, you can push a change to a Git remote. Likewise, when the remote gets changed, you can pull the changes back to your local repository.

Today, you'll learn how to do the pull from the remote back to your repository.

## Making a change to the remote

Usually, a change to the remote is made by another person who's working on the same project. They change the code on their computer, and they push it to the remote repository.

Once the remote repository changes, you can pull it back to your local repository to get the updated version.

That's the standard workflow.

But, since I'm working on the project alone, I'm going to show you how to change the remote repository directly on Github. Once we're done, we'll pull from there.

## Changing the Github repository directly

Let's say we want to change the `README.md` text.

To do so, you can click on the pencil icon beside the Readme file. This brings you to an editor where you can change the text.

<figure>
  <img src="https://zellwk.com/images/2018/git-pull/edit-readme.png" alt="A text editor shows up after you click the pencil icon">
  <figcaption aria-hidden>Github's editor</figcaption>
</figure>

Once you're done. Scroll down to the bottom and write a commit message. You can click on the green button to commit the changes directly on Github.

<figure>
  <img src="https://zellwk.com/images/2018/git-pull/edit-readme-commit.png" alt="Committing the changes">
  <figcaption aria-hidden>Committing the changes</figcaption>
</figure>

The project will be updated.

## Fetching changes

Fork and other Git clients can show you the changes to a remote repository. They do it through a command called Git Fetch.

You can do a Fetch yourself by clicking on the empty arrow that points downwards. It's the leftmost arrow button on the top left-hand corner

<figure>
  <img src="https://zellwk.com/images/2018/git-pull/fetch.png" alt="the fetch button">
  <figcaption aria-hidden>The fetch button</figcaption>
</figure>

Fetch checks the remote repository for any changes. It's like an email client that says you have three emails to read.

Once the Fetch is completed, you can see in the Git history that `origin/master` is on the `update README.md` commit, and the `update README.md` commit is one commit ahead of our local master branch.

<figure>
  <img src="https://zellwk.com/images/2018/git-pull/history-1.png" alt="`origin/master` tag is one commit ahead of the `master` tag. ">
  <figcaption aria-hidden>`origin/master` tag is one commit ahead of the `master` tag.</figcaption>
</figure>

On the sidebar, you can see the number 1 beside our master branch, and an arrow that points downwards. This tells us our branch is one commit behind the remote.

<figure>
  <img src="https://zellwk.com/images/2018/git-pull/branch" alt="Sidebar shows a number 1 and a downwards arrow">
  <figcaption>The master branch on the side tells us the same information—our master branch is one commit behind the remote.</figcaption>
</figure>

## Pulling changes

To update your local branch, you can click on the pull button. The pull button is the filled downwards arrow at the top left-hand corner. It's the one between Fetch and Push.

<figure>
  <img src="https://zellwk.com/images/2018/git-pull/pull.png" alt="The pull button">
  <figcaption aria-hidden>The pull button</figcaption>
</figure>

When you click on Pull, you'll be able to select the branch you want to pull. Since we have tracked it previously, you can pull the master branch directly by clicking pull again.

<figure>
  <img src="https://zellwk.com/images/2018/git-pull/pull-menu.png" alt="Menu that opens up after clicking pull.">
  <figcaption>Click on pull again to pull changes</figcaption>
</figure>

When you pull the branch from the remote to your local repository, you'll see that `master` moves up to the same commit as `origin/master`.

<figure>
  <img src="https://zellwk.com/images/2018/git-pull/history-2.png" alt="`master` and `origin/master` are on the same commit again">
  <figcaption aria-hidden>`master` and `origin/master` are on the same commit again.</figcaption>
</figure>

## Wrapping up

Fetch checks if there are any changes in the remote repository.

Pull brings the changes from the remote repository to your local repository.

<hr>

Thanks for reading. This article was originally posted on [my blog](https://zellwk.com/blog/pulling-from-a-git-remote). Sign up for [my newsletter](https://zellwk.com) if you want more articles to help you become a better frontend developer.