git: minor tweaks to my git commands

This commit is contained in:
Fernando Schauenburg 2024-07-14 02:33:00 +02:00
parent 0f85776d14
commit 3fc86cf7c6
2 changed files with 21 additions and 13 deletions

View file

@ -1,10 +1,8 @@
#!/bin/bash #!/bin/sh
# #
# Written by Corey Haines # List files with commit count.
# Scriptified by Gary Bernhardt
# #
# Put this anywhere on your $PATH (~/bin is recommended). Then git will see it # Based on: https://github.com/garybernhardt/dotfiles/blob/main/bin/git-churn
# and you'll be able to do `git churn`.
# #
# Show churn for whole repo: # Show churn for whole repo:
# $ git churn # $ git churn
@ -16,8 +14,16 @@
# $ git churn --since='1 month ago' # $ git churn --since='1 month ago'
# #
# (These are all standard arguments to `git log`.) # (These are all standard arguments to `git log`.)
#
set -e exec git log --all \
git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort -n | awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}' --find-copies \
--find-renames \
--name-only \
--format='format:' \
"$@" \
| sort \
| grep -v '^$' \
| uniq -c \
| sort -n \
| awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}'

View file

@ -1,7 +1,9 @@
#!/bin/sh #!/bin/sh
#
# Initialize a git repository and automatically create an empty root commit. # Initialize a git repository and automatically create an empty root commit.
# NOTE: requires the `l` alias to be defined (see .gitconfig) #
set -e
git init && git commit --allow-empty -m "Initial commit" && git l git init
git commit --allow-empty -m "Initial commit"
git log --graph --pretty='%C(auto)%h%d %s %C(8) %ad'