Skip to content

Instantly share code, notes, and snippets.

@siayi
Forked from lehnerpat/gh-compare.md
Created October 31, 2018 14:37
Show Gist options
  • Save siayi/0b2e7e18be8a9d443f6b069979f21517 to your computer and use it in GitHub Desktop.
Save siayi/0b2e7e18be8a9d443f6b069979f21517 to your computer and use it in GitHub Desktop.
GitHub Compare view

GitHub's compare view is available at:

https://github.com/$USER/$REPO/compare/$REV_A...$REV_B

Naturally, $USER and $REPO are the owner (user/organization) and repository names, respectively.

$REV{A,B} are the two sides of the compare view; they can either be a ref in $USER's repository, i.e. the name of a branch, tag or a commit SHA, or it can be a ref in $OWNER's fork of the repository by using the format $OWNER:$REF.

You can get a diff or patch for the result of the compare view by appending .diff or .patch to the URL, respectively.


Examples:

https://github.com/octocat/Spoon-Knife/compare/ed12290ba...master
Default usage is pretty straight-forward.

https://github.com/SomeUserName/Spoon-Knife/compare/master...ForkerChamp:topic/awesome-feature
Branchname is topic/awesome-feature in ForkerChamp's repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment