Checking out a pull request

Hi there,

as the more adventurous users know, it’s easy to compile and try out applications hosted at e.g. HaikuArchives: Just go to a project’s page, copy the URL you find by pressing the green “Clone or download” button and paste it after “git clone” in Terminal.

When a project is under development, you may find “pull-requests” on its github page with interesting changes you may want to test and give feedback.

It’s easy to checkout a specific PR for testing, it turns out. For people familiar with git, this is most likely old hat, but I stumbled on it and decided to just post it here.

Put this in your ~/config/settings/profile:

function getpr() {
	git fetch origin pull/$1/head:pr$1;
	git checkout pr$1;

Now, after you’ve cloned the project and changed into its directory, a simple getpr 112 will fetch the PR #112 (as an example) into a new branch “pr112” and changes into it. Now you can build the software with the changes made in PR #112.


Thanks for the information!

Or use the awesome “hub” tool which is available from the repos. It can checkout a pull request directly from its github URL:

hub checkout

And it does not assume your remote is named “origin” ;).

That’s nice, too. Still, for my regular HaikuArchives or haikuports PR-checkout, I prefer only having to pass the PR number.