diff --git a/dot_config/git/executable_config b/dot_config/git/executable_config index 40efb0e..2fe8bd7 100644 --- a/dot_config/git/executable_config +++ b/dot_config/git/executable_config @@ -17,3 +17,45 @@ sort = version:refname [help] autoCorrect = prompt +[alias] + c = commit + ca = commit --amend + cane = commit --amend --no-edit + s = status + ss = status --short + a = add + ap = add -p + pullr = pull --rebase + pushf = push --force-with-lease + co = checkout + br = branch + l = log --oneline + last = log -1 + uadd = restore --staged + undo = reset HEAD~1 + # source: https://github.com/GitAlias/gitalias + churn = !"f() { git log --all --find-copies --find-renames --name-only --format='format:' \"$@\" | awk 'NF{a[$0]++}END{for(i in a){print a[i], i}}' | sort -rn; }; f" + active-emails = "!f() { git log \"$@\" --format=\"%aE\" | awk '{a[$0]++}END{for(i in a){print a[i], int((a[i]/NR)*100) \"%\", i}}' | sort -nr; }; f" + active-days = "!f() { git log \"$@\" --format=\"%ad\" --date=format:\"%Y-%m-%d\" | awk '{a[$0]++}END{for(i in a){print a[i], int((a[i]/NR)*100) \"%\", i}}' | sort -nr; }; f" + summary = "!f() { \ + printf \"Summary of this branch...\n\"; \ + printf \"%s\n\" $(git rev-parse --abbrev-ref HEAD); \ + printf \"%s first commit timestamp\n\" $(git log --date-order --format=%cI | tail -1); \ + printf \"%s last commit timestamp\n\" $(git log -1 --date-order --format=%cI); \ + printf \"\nSummary of counts...\n\"; \ + printf \"%d commit count\n\" $(git rev-list --count HEAD); \ + printf \"%d date count\n\" $(git log --format=oneline --format=\"%ad\" --date=format:\"%Y-%m-%d\" | awk '{a[$0]=1}END{for(i in a){n++;} print n}'); \ + printf \"%d tag count\n\" $(git tag | wc -l); \ + printf \"%d author count\n\" $(git log --format=oneline --format=\"%aE\" | awk '{a[$0]=1}END{for(i in a){n++;} print n}'); \ + printf \"%d committer count\n\" $(git log --format=oneline --format=\"%cE\" | awk '{a[$0]=1}END{for(i in a){n++;} print n}'); \ + printf \"%d local branch count\n\" $(git branch | grep -v \" -> \" | wc -l); \ + printf \"%d remote branch count\n\" $(git branch -r | grep -v \" -> \" | wc -l); \ + printf \"\nSummary of this directory...\n\"; \ + printf \"%s\n\" $(pwd); \ + printf \"%d file count via git ls-files\n\" $(git ls-files | wc -l); \ + printf \"%d file count via find command\n\" $(find . | wc -l); \ + printf \"%d disk usage\n\" $(du -s | awk '{print $1}'); \ + printf \"\nMost-active authors, with commit count and %%...\n\"; git active-emails | head -7; \ + printf \"\nMost-active dates, with commit count and %%...\n\"; git active-days | head -7; \ + printf \"\nMost-active files, with churn count\n\"; git churn | head -7; \ + }; f"