Skip to content

Instantly share code, notes, and snippets.

@wasnotrice
Created April 18, 2014 18:43
Show Gist options
  • Select an option

  • Save wasnotrice/11058583 to your computer and use it in GitHub Desktop.

Select an option

Save wasnotrice/11058583 to your computer and use it in GitHub Desktop.
Show the short SHA of the HEAD commit, and copy it to the clipboard (OS X)
#!/usr/bin/env bash
#
# Print the short version of a git revision and copy it
# to the OS X clipboard
REV=${1-HEAD}
git rev-parse --short $REV -- | tee >(tr -d '\n' | pbcopy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment