Pages

Sunday, January 30, 2011

GitHub Tip: download commits as patches

Some time ago, the brilliant GitHub people gave me the following tip. Rajarshi is lazy, and might find it interesting. By appending .patch to the commit URL, a commit can easily be downloaded as patch. For example, Dmitry made this commit in his branch, having the URL https://github.com/dmak/cdk/commit/9b0478d50c7b5ca10f77fb01d89329db5fe80625. The patch for this commit can then be downloaded at this URL https://github.com/dmak/cdk/commit/9b0478d50c7b5ca10f77fb01d89329db5fe80625.patch.

That way, developers can easily download it with wget and apply it locally with git am, without having the fetch the full repository.

5 peer reviews:

  1. I just love this tip! Thanks for sharing, this is just what I was looking for.

    ReplyDelete
  2. Gah, so obvious! ...but why isn't there a giant link to do this on the page itself?

    Thanks for the post!

    ReplyDelete
  3. Thank you very much for the tip :-)
    github should really place a "Download as.."-button there!

    ReplyDelete
  4. awesome tip.

    yea, the code page itself has a "raw" button. I think the view for the commit page just hasn't hooked to .patch for that "raw" context. seems it would be an easy route to add.

    ReplyDelete