Skip to main content
AllDevToolsHub
Back to all patterns

Git Short SHA (7 hex)

Validation

Matches a 7-character abbreviated Git commit SHA.

/^[0-9a-f]{7}$/

How it works

Git typically displays the first 7 hex characters of a SHA-1 hash as an abbreviated commit ID. For larger repos, prefer 8 or more characters for uniqueness.

Test Cases

Should Match

  • abc1234
  • deadbee
  • f00ba12

Should NOT Match

  • ABC1234
  • abc123
  • 12345678

Quick Summary

Matches a 7-character short Git SHA (lowercase hex).