Generally when cloning a forked repo from GitHub it will bring/checkout only the master branch.
Problem: how can I do work on that gh-pages branch?
This is the solution that worked just fine in my case…
Take a look at the following screenshot:
Figure 1 - Checkout remote branch (not master) named gh-pages to a local branch with upstream tracking
When you open Git bash it has the (master) branch already checked out as you see in “yellow” above.
Executing the command:
git remote show origin
we see that the repo has 3 Remote branches, namely:
however only the master branch is configured for git pull and git push on my local computer. That’s ok if I would do some work on the master branch. If that was the case I already had everything correctly setup but remember that I need to do work on the gh-pages branch. To do so, the following command must be executed:
git checkout –b gh-pages –-track origin/gh-pages
What this command does is:
With git checkout we create a new local branch called gh-pages and immediately switch to it with the –b parameter. See that the branch name matches the one from the remote origin, in this case, gh-pages.
The –-track parameter means that this new local branch has its upstream set to a remote branch, in this case origin/gh-pages.
This is the result I wanted.
As a visual clue, in the following screenshot you see that the branch now shows in Visual Studio 2013 Team Explorer window as the selected one. This means it made it to my local computer. Now I can work on it and when done I can click on that Changes link and push my changes to the remote origin.
Figure 2 - gh-pages branch appears in Published Branches in Visual Studio 2013 Team Explorer window
By the way, here’s the official doc reference for the checkout command. It depicts exactly what I wanted to do but had no idea how to do it :
Hope it helps!
Ops… hehehe. Just know I read the guideline to contribute to Font-Awesome… too late!
I should have submitted the pull request against the 4.1.0-wip branch where wip means (work in progress).
Figure 3 - Creating a tracking branch with Git Gui with the same name [ 4.1.0-wip ] as defined in origin
To get to Git Gui, right click the repo folder on the disk and select Git Gui in the context menu.
To create a new branch, click the Branch menu then Create…
See that I selected Match Tracking Branch Name and made Tracking Branch point to origin/4.1.0-wip. Then clicked the Create button.
What this does is the same thing achieved with that previous Git checkout command executed above. The only difference is that now it’s all visual.
It’s real nice to have options to get the job done.