bash: move glogs to scripts

Signed-off-by: Michael Grote <michael.grote@posteo.de>
This commit is contained in:
Michael Grote 2024-06-05 20:14:04 +02:00
parent 5f217de747
commit 2989151380
3 changed files with 11 additions and 14 deletions

View file

@ -87,20 +87,6 @@ EOF
fi
esac
}
function glogs {
# https://git-scm.com/docs/pretty-formats
# https://stackoverflow.com/questions/3631005/git-log-tabular-formatting
# https://stackoverflow.com/questions/7736781/how-to-make-git-log-not-prompt-to-continue
if [ -z "$1" ]; then
ncommits=30;
else
ncommits="$1";
fi;
git log --pretty=format:'%C(auto) %<|(16,trunc)%h %Cred %G?%Creset %<|(60,trunc)%s %<(20,trunc)%Cgreen%cr%Creset %<(15,trunc)%Cblue%an%Creset %Cred%D' --graph --all -"$ncommits"
}
function gp {
git pull "$@"
}
function mdtoc {
grep --recursive --include="*.md" ^# | sort --version-sort --field-separator=":" | awk 'BEGIN {FS=":"}{print $2 "&&" $1}' | column --table --separator "&&" --table-truncate 1,2
}

1
scripts/git_logs Symbolic link
View file

@ -0,0 +1 @@
glogs

10
scripts/glogs Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
# https://git-scm.com/docs/pretty-formats
# https://stackoverflow.com/questions/3631005/git-log-tabular-formatting
# https://stackoverflow.com/questions/7736781/how-to-make-git-log-not-prompt-to-continue
if [ -z "$1" ]; then
ncommits=30;
else
ncommits="$1";
fi;
git log --pretty=format:'%C(auto) %<|(16,trunc)%h %Cred %G?%Creset %<|(60,trunc)%s %<(20,trunc)%Cgreen%cr%Creset %<(15,trunc)%Cblue%an%Creset %Cred%D' --graph --all -"$ncommits"