Reputation: 2579
I want to look at a commit by ID. For instance, I want to know the code that got committed for that ID, something like:
git log <commit_id>
And this would display the committed code and commit message that corresponds to this ID.
Upvotes: 116
Views: 182176
Reputation: 2487
MODEL
git log --all --grep='<MENSAGE_CONTENT>'
EXAMPLE
git log --all --grep='Merge pull request #240'
MODEL
git show <COMMIT_HASH> --no-patch
git show <COMMIT_HASH_PART> --no-patch
EXAMPLE
git show b8c3fd58a0db675a6d9b9e819419f6ebc967278a --no-patch
git show b8c3fd5 --no-patch
[Ref(s).: https://stackoverflow.com/a/7124949/3223785 , https://stackoverflow.com/a/53685160/3223785 ]
Upvotes: 5
Reputation: 37328
@SethRobertson's solution works for me but it shows a diff. I wanted to see it exactly like git log
shows it. So add --no-patch
:
git show <commit_id> --no-patch
I learned this from - https://stackoverflow.com/a/31448684/1828637
Upvotes: 35
Reputation: 31471
git show <commit_id>
is the droid you are looking for, probably.
Upvotes: 202