Now continue working on our new branch in your local Git repository.
First, pull from the GitHub repository again to ensure your code is up-to-date.
[user@localhost] $ |
git pull |
Our main branch is now up-to-date, and we can see that a new branch is available on GitHub.
Perform a quick status check:
[user@localhost] $ |
git status |
And confirm which branches we have and which one we are currently working on.
[user@localhost] $ |
git branch |
We don’t have the new branch in our local Git yet, but we know it’s available on GitHub. We can use the -a option to view all local and remote branches.
[user@localhost] $ |
git branch -a |
Note: branch -r shows only remote branches. |
We see that the html-skeleton branch is available remotely but not in our local Git repository. Let’s check it out.
[user@localhost] $ |
git checkout html-skeleton |
And verify if it is up-to-date.
[user@localhost] $ |
git pull |
What branches do we have now, and which one are we currently working on?
[user@localhost] $ |
git branch |
Now, open your favorite editor and confirm that the changes from the GitHub branch are reflected.
That’s how you pull a GitHub branch into your local Git repository.