PyTux

Trips of a curious penguin.

Hello, time traveler! You are reading an article that is almost ten years old. The world has changed, and so have I and my opinions. There is a good chance what's below is not current, correct, or secure anymore, and maybe it never was. This page is preserved because I am an archivist at heart, but you have been warned.

GitHub: checkout a pull request as a branch

Today looking at the Travis log of a Pull request build I saw this interesting command:

1
git fetch origin +refs/pull/611/merge:

Turns out that GitHub makes available from your main remote the PR branches as remote refs.

Also (discovered by blind guessing), if you change /merge with /head you get a ref to the clean PR head, unmerged with its target branch. What can be the most useful is up to you, I guess.

This is probably easy because GH on its side stores all the forks of a repo as the same Git repository.

An example in the Coderwall ProTip linked at the title.