git rev-parse --abbrev-ref HEAD
git symbolic-ref --short HEAD #probably works for 1.8 and newer clients
git --no-pager show -s --format='%ae' COMMIT_HASH #get author e-mail
git --no-pager show -s --format='%an <%ae>' COMMIT_HASH #get author name and e-mail in user <email> format
git rev-list --max-count=1 HEAD
git log -n 1 --pretty=format:"%H"
git --no-pager show -s --format='%H'
Have the following script with executable permission anywhere based on $PATH
#!/bin/bash
format='%Cblue%h%Creset %s%x09%ar'
git ls-tree --name-only -z HEAD |
while IFS= read -d '' file; do
git log -1 --pretty="$file"$'\t'"$format" -- "$file"
done |
column -t -s $'\t'
samar[at]techgaun[dot]com