Hacker News new | past | comments | ask | show | jobs | submit login
Checkout github pull requests locally (gist.github.com)
178 points by DanielRibeiro on March 25, 2013 | hide | past | favorite | 12 comments



Defunkt's hub tool adds a ton of GitHub-friendly commands to git, including the ability to check out a pull request and create one from the command line.

https://github.com/defunkt/hub


That's part of my workflow, too. The nice part is, that you can use the URL of the PR, e.g. `hub checkout https://github.com/addyosmani/todomvc/pull/473`


I cannot believe I didn't know this existed.

Worth checking out!


Hub is wonderful. Everyone reading this, use it! :)


Be sure to read the full discussion (as of now) - it mentions further options (like global configuration) and some important points - like the order of fetch config statements.


The downside with this approach is that, with active projects, you end up with hundreds of remote branches. They'll never get deleted with `fetch -p`, and if you remove them manually they'll just come back.


I'm not quite sure I understand. Why would you checkout a PR over the pushed remote branch that the PR references?

e.g. I push feature/foo to origin and open a pull request base develop. Why would one not just pull down feature/foo?


I had the same question, but then I realized where this tip is useful: for open-source projects where the PR came from someone else's fork. With this tip, you don't have to add the forked remote in order to pull it.


Also, if you delete the original branch that the PR refers to, the PR branch still has all of the commits.


'doh! Thanks!


Interrupting work to visit the github site is a pain, so glad to see these tools out. I had assumed hub was github internal so I will give that a try


loved it




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: