Pulling a Branch from GitHub
Now continue working on our new branch in our local git.
Lets pull from our GitHub repository again so that our code is up-to-date:
remote: Enumerating objects: 5, done.
remote: count objects: 100% (5/5>
, done. remote: pressing objects: 100% (3/3>
, done. remote: Total 3 (delta 2>
, reused 0 (delta 0>
, pack-reused zero Unpacking objects: 100% (3/3>
, 851 bytes | nine.00 KiB/s, done. From https://github.com/w3schools-test/hello-world * [new branch] html-skeleton -> origin/html-skeleton Already up so far.
Now our main branch is up todate. and that we will see that there's a new branch out there on GitHub.
Do a quick status check:
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
And confirm that branches we've got, and wherever we ar working at the moment:
So, we don't have the new branch on our local git. but we all know it's available on GitHub. thus we are able to use the -a option to see all native and remote branches:
git branch -a * master remotes/origin/html-skeleton remotes/origin/master
Note: branch -r is for remote branches only.
We see that the branch html-skeleton is out there remotely, however not on our local git. Lets check it out:
git checkout html-skeleton
Switched to a new branch 'html-skeleton'
Branch 'html-skeleton' set up to track remote branch 'html-skeleton' from 'origin'.
And check if it is all up to date:
Already up to date.
Which branches will we have now, and where ar we working from?
Now, open your favourite editor and make sure that the changes from the GitHub branch carried over.
That is how you pull a gitHub branch to your local Git.