Skip to content

Instantly share code, notes, and snippets.

@gbroques
Last active August 20, 2021 15:40
Show Gist options
  • Save gbroques/109615d7304bfea189c09c2709d77e96 to your computer and use it in GitHub Desktop.
Save gbroques/109615d7304bfea189c09c2709d77e96 to your computer and use it in GitHub Desktop.
Watch HEAD on Git Bash
#!/bin/bash
# https://gist.github.com/espaciomore/28e24ce4f91177c0964f4f67bb5c5fda
# https://gist.github.com/gbroques/80ec85c6557e70deb845d79c6b44fcf0
ARGS="${@}"
clear;
while(true); do
OUTPUT=$(cat .git/HEAD)
ref=$(echo $OUTPUT | awk '{print $2}' | xargs -I {} cat .git/{})
commit_message=$(git log --format=%B -n 1 $ref)
clear
printf "\n HEAD\n"
echo -e " ${OUTPUT[@]}"
printf "\n ref:\n"
echo -e " ${ref}"
printf "\n"
echo -e " ${commit_message}"
sleep 2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment