Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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.

@chucklu

This comment has been minimized.

Copy link

chucklu commented Jul 20, 2019

Thanks for the your gist
I got the compare page as wanted HearthSim/HearthDb@855b8e8...f1441ad

@jcguu95

This comment has been minimized.

Copy link

jcguu95 commented Aug 6, 2019

Can this be done locally? I wish to keep track of how I edit my essays without uploading them to GitHub..

@chucklu

This comment has been minimized.

Copy link

chucklu commented Aug 6, 2019

@jcguu95 You can fetch two remote to local repository, and compare commits.

@lyuxxx

This comment has been minimized.

Copy link

lyuxxx commented Aug 6, 2019

Thanks

@geotrev

This comment has been minimized.

Copy link

geotrev commented Nov 9, 2019

Huge thank you. Saved me a lot of searching. :)

@joker234

This comment has been minimized.

Copy link

joker234 commented Nov 21, 2019

Thx for that :)

Does anyone know a method to get only a comparison of a subtree (subdirectory)?

@chhavi8191

This comment has been minimized.

Copy link

chhavi8191 commented Feb 10, 2020

Thanks. Saved a lot of time. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.