Copy Git commit SHA hash


Get Git commit SHA-1 hash from HEAD:

git log --oneline | head -1 | awk '{print $1}'

Copy Git commit SHA-1 hash to macOS clipboard:

git log --oneline | head -1 | awk '{print $1}' | pbcopy


If you enjoyed this post, please consider supporting this site!