Here is a high-level explanation of the GitHub branch-based workflow.
Below, are step by step instructions for implementing this workflow.
You can create branches either remotely or locally.
After you create a branch remotely, you need to pull it to your local repo ...
$ git fetch origin
$ git checkout remote-branch-name
Check which branch you are currently on, the * indicates the current branch ...
$ git branch
* master
some-other-branch-you-are-not-on
Checkout the master branch ...
$ git checkout master
Update local master branch ...
$ git pull origin master
Branch from master, and checkout a new local branch ...
$ git checkout -b new-feature-branch
See, now you are on the new-feature-branch, so start coding!
$ git branch
master
* new-feature-branch
Alright, you've been coding for a while, and you implemented a really cool new feature. Check if there are changes in your local branch to be committed ...
$ git status
Add all changes at once ...
$ git add .
Make a commit, write a human readable message (in the present tense), and add it to the commit log ...
$ git commit -m "Adding my cool new feature!"
Push your local changes to the remote repo ...
$ git push origin new-feature-branch
If your push is rejected, then your local branch might be out of sync with the remote repo, so update your local branch first ...
$ git pull origin new-feature-branch
Now that you pushed your changes to the remote repo, all the work from this point onwards should be done via the GitHub web interface.
The designated reviewer of the pull request should review the code, make comments, suggest changes, and after everything is done, approve the pull request.
Finally, we merge our cool new feature into the master branch, and make it "official".