Working with github's pull request workflow

Mon, Aug 13, 2012

Recently, I have given a response similar to this at least a half-dozen times and thought it could be useful here. I work with many github repositories and manage them each and every day. Below is the workflow I use to make things simple, easy and efficient.

First off, whoever you are pulling from is the ‘upstream’ repo. My example uses the the saltstack repository (git://github.com/saltstack/salt.git). Make sure it’s set to the read only git url so as to not accidentally push to upstream directly. To set this, you can do the following operation in your repository:

git remote add upstream git://github.com/saltstack/salt.git

Next, adjust the origin repository to point to your fork of the saltstack repository. In my case, my username is ‘herlo’ so my ssh-based read-write git url would be ‘git@github.com:herlo/salt.git’. To adjust the values, do the following:

git remote set-url origin git@github.com:herlo/salt.git

It’s possible that ‘origin’ isn’t set, but if you cloned originally from the saltstack repo, it will need to be adjusted.

Finally, it’s good to verify this, run ‘git config –list’ and look for lines similar to what I show below. If you have yours configured this way, you are ready to work with the github pull request structure simply and efficiently.