Skip to content

Instantly share code, notes, and snippets.

@adi518
Forked from scottwb/get_git_branch_sha.sh
Created June 25, 2019 12:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adi518/6098da664db2a09b2c4ba0cc3423f6ca to your computer and use it in GitHub Desktop.
Save adi518/6098da664db2a09b2c4ba0cc3423f6ca to your computer and use it in GitHub Desktop.
Get the SHA of some git branch.
# Get the SHA of some branch. There must be a better way to do this.
git log -1 --pretty=oneline origin/somebranch | sed -E "s/^([^[:space:]]+).*/\1/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment