dopplesoldner dopplesoldner - 11 months ago 47
Git Question

Find a commit on GitHub given the commit hash

I am fairly new to Github and have come across an amateur-ish problem.

I have been asked to do a code review and have been provided with a commit hash, however I have tried looking in Git if I can search using commit hashes but couldn't find anything.

Is there a way I can find the changed code just by using the commit hash?


A URL of the form<owner>/<project>/commit/<hash> will show you the changes introduced in that commit. For example here's a recent bugfix I made to one of my projects on GitHub:

You can also shorten the hash to any unique prefix, like so:

I know you just asked about GitHub, but for completeness: If you have the repository checked out, from the command line, you can achieve basically the same thing with either of these commands (unique prefixes work here too):

git show 35e32b6a00dec02ae7d7c45c6b7106779a124685
git log -p -1 35e32b6a00dec02ae7d7c45c6b7106779a124685