Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing complete git hash -- not the compressed hash

Tags:

git

How do we get a list with full hashes ?

git reflog

I could not find about it in the docs.

5826591 HEAD@{0}: commit : Forgot password
c8a98d1 HEAD@{1}: commit : cleaned
02338ed HEAD@{2}: commit : forward to login page
528bec8 HEAD@{3}: commit : password changed
like image 202
maan81 Avatar asked Sep 04 '16 01:09

maan81


People also ask

How do I view commit hash?

If you have the hash for a commit, you can use the git show command to display the changes for that single commit. The output is identical to each individual commit when using git log -p .

What determines git hash?

Hashes are what enable Git to share data efficiently between repositories. If two files are the same, their hashes are guaranteed to be the same. Similarly, if two commits contain the same files and have the same ancestors, their hashes will be the same as well.

What does SHA mean in git?

"SHA" stands for Simple Hashing Algorithm. The checksum is the result of combining all the changes in the commit and feeding them to an algorithm that generates these 40-character strings. A checksum uniquely identifies a commit.

How does git hash a file?

Git uses hashes in two important ways. When you commit a file into your repository, Git calculates and remembers the hash of the contents of the file. When you later retrieve the file, Git can verify that the hash of the data being retrieved exactly matches the hash that was computed when it was stored.


2 Answers

Just execute:

> git reflog --no-abbrev
like image 60
Marcelo Ávila de Oliveira Avatar answered Sep 29 '22 08:09

Marcelo Ávila de Oliveira


nb. I should mention this answer just list commit's not all entries (like rebase, pull etc)

git reflog can accept format options the same as git log.

So you could use this…

git reflog show --format='%C(auto)%H %<|(17)%gd: commit : %s'

Which you get you output like this:

f2801fa5ea4a28b573ce14d6ca8502a9dd8dc7a1 HEAD@{39}: commit : Initial commit
7de68d559ccf7a3435af9ddaa432c81cb59a20fc HEAD@{40}: commit : Add Update packages playbook for simplicity
f63b2757f2b19188d89fe7bb0f76c56ebee3634f HEAD@{41}: commit : Preliminary structure
like image 20
Craig Avatar answered Sep 29 '22 08:09

Craig