Skip to content

Instantly share code, notes, and snippets.

@m-makuch
Created May 4, 2020 15:15
Show Gist options
  • Select an option

  • Save m-makuch/a5039f26fd65e00bf12f5b5b7083ca02 to your computer and use it in GitHub Desktop.

Select an option

Save m-makuch/a5039f26fd65e00bf12f5b5b7083ca02 to your computer and use it in GitHub Desktop.
Extract first 7 characters of git commit hash
#!/usr/bin/env bash
set -e
HEAD_HASH=$(git rev-parse HEAD)
HEAD_HASH=${HEAD_HASH:0:7}
echo $HEAD_HASH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment