Created
March 23, 2020 23:55
-
-
Save furnox/098b86b19d6963b70a26a2806123133c to your computer and use it in GitHub Desktop.
Nice little bash script to show better information on a git commit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Call on .gitconfig with: "!bash -ec 'loggr $0 | less -r'" | |
# Params: | |
# commit - pass in commit to display just that commit | |
# | |
if [[ $1 != 'bash' ]]; then | |
if [[ $1 =~ [0-9a-f]{7} ]]; then | |
rl=($1) | |
else | |
rl=$(git rev-list --no-merges HEAD -- $1 | grep -ve '\w{41}') | |
echo $c | |
fi | |
else | |
rl=$(git rev-list --no-merges HEAD | grep -ve '\w{41}') | |
fi | |
esc=$(printf '\033') | |
for r in $rl; do | |
git log -1 --name-status --abbrev-commit --pretty=medium --color=always $r | sed -E "s/^(M)\s/$esc[0;34m\1$esc[0m\t/g; s/^(D)\s/$esc[0;31m\1$esc[0m\t/g; s/^(A)\s/$esc[0;32m\1$esc[0m\t/g" | |
echo -e '\r' | |
echo $(printf '#%.0s' {1..80}) | |
echo -e '\r' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment