Friday, August 16, 2013

Committing to Github From a Local Branch to a Different Remote Branch

So you've made your changes and your are ready to commit them to not only your local branch, but also Github. 

Step 1: Group the files you added and modified to a single pending changelist

Grouping files together make your Github pull requests much easier to handle -- especially if you are looking to resolve a specific issue or make a specific enhancement. git add . is the equivalent of a recursive add for everything from the current directory downwards [More Information].
$ git add .
This will show everything that has been marked as a change. A good sanity check that the pending changelist contains everything you expect. The "-s" means short output.
$ git status -s

Step 2: Commit the changelist to your local branch. 

This will commit your pending changelist it to whichever is the active branch
$ git commit

Step 3: Push the committed changes from your current active local branch to the upstream remote branch.

Note: "origin" is your local repository

$ git push origin example-local-branch:new-remote-branch
Username for 'https://github.com': xxxx@boldersecurity.com
Password for 'https://xxxx@boldersecurity.com@github.com':
To https://github.com/boldersecurity/gauntlt.git
* [new branch]      example-local-branch -> new-remote-branch