Monday, September 27, 2021

How many digits in git SHA to identify a commit?

 


How many digits in a git SHA makes it to identify the commit? 


7 digits are the Git default for a short SHA, so that's fine for most projects. 

For  ~30k commits, 8 or 10 digits should be perfectly fine.

==

To get the last abbreviated one:

git rev-parse --short HEAD

To list the log entries with abbreviated ones:
git log --abbrev-commit