git: add lazy checkin scripts
This commit is contained in:
19
.mgr_config/bin/git-lazy-description
Executable file
19
.mgr_config/bin/git-lazy-description
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
diffstat="$(git diff --staged --numstat | awk '{print ($1 + $2), $3}' | sort -k1nr)"
|
||||
count=$(echo "$diffstat" | wc -l)
|
||||
if [[ -z "$diffstat" ]]; then
|
||||
echo "No staged changes to describe" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
file=$(echo "$diffstat" | head -n1 | cut -f2 -d' ')
|
||||
|
||||
if [[ $count -eq 1 ]]; then
|
||||
echo "Update $file"
|
||||
elif [[ $count -gt 1 ]]; then
|
||||
echo "Update \`$file\` and $((count - 1)) other files"
|
||||
fi
|
||||
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user