GitHub pull requests as seen by GIT
First off, some links to github documentation:
- GitHub: Using pull requests (the clickety-click way)
- GitHub: Checking out pull requests (The GIT way)
For just working with pull requests and even manually fetching / merging pull requests locally this information is more than enough. I found that by adding a new refspec, my branches are getting polluted with a looooong list of pull requests for certain projects. I would rather have a simple quick execute-once way of doing the same thing.
An extremely simple way is by adding a new alias:
git config alias.fpr '!sh -c "git fetch origin pull/${1}/head:pr/${1}" -'
This allows you to use git fpr 696
to pull in #696. Mind you, the remote is hardcoded to ‘origin
‘ here.
In some cases, I’m really inpatient towards pull requests on upstream repositories and I want to merge them in my local repository more easily.
I created the following script for just that: git-merge-pr.sh.
A quick example:
$ ./git-merge-pr.sh 696
$ git log -n1
commit c0f62a0b1ed09ce928d35a90854a1eb2c2ac6d10
Merge: 1d837ed 54988e1
Author: Jan Vansteenkiste
Date: Tue May 6 06:48:43 2014 +0200
Merged pull request: #696: Bugfix/debian control file permissions
See jordansissel/fpm#696 for more information
* pr/696:
Ignore lsb init scripts warning since we are not providing a proper init script for testing
Feeling brave, enable lintian for travis
Fix file permissions on deb control files
Conflicts:
.travis.yml