Contenido del Curso
GitHub Fundamentals
GitHub Fundamentals
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:
- We switched to the
john/test
branch; - Git automatically copied the remote branch's contents into the local branch;
- 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:
¡Gracias por tus comentarios!