Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Pulling Changes | Basic Interaction with Remotes
GitHub Fundamentals
course content

Kursinnhold

GitHub Fundamentals

GitHub Fundamentals

1. Introduction to GitHub
2. Basic Interaction with Remotes
3. More Advanced Workflows

book
Pulling Changes

As a matter of fact, fetching and then immediately merging changes is an extremely common scenario. That's why Git provides a single command, git pull, that combines these two operations and integrates the changes into the current branch.

Let's now pull the remote changes made by John into our local repository:

As you can see, the output of this command is basically a combination of the outputs of the git fetch and git merge commands.

You can also run the git remote show origin command to see that there is indeed a remote john/test branch, but our local repository doesn't have the corresponding local branch.

Let's create a local branch for it by running the git checkout command:

Let's break down what has just happened:

  1. We switched to the john/test branch;
  2. Git automatically copied the remote branch's contents into the local branch;
  3. The working tree has been updated to reflect the contents of the john/test branch.

We can easily verify that we are on this branch and that it is up-to-date with its remote counterpart by looking at the latest commit:

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 2. Kapittel 6
Vi beklager at noe gikk galt. Hva skjedde?
some-alt