4 ms·
I have a summary alias that kind of does similar things # summary: print a helpful summary of some typical metrics summary = "!f() { \ printf \"Summary
by mattrighetti 6mo ago
I have a summary alias that kind of does similar things
# summary: print a helpful summary of some typical metrics
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 latest commit timestamp\n\" $(git log -1 --date-order --format=%cI); \
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 log-of-count-and-email | head -7; \
printf \"\nMost-active dates, with commit count and %%...\n\"; git log-of-count-and-day | head -7; \
printf \"\nMost-active files, with churn count\n\"; git churn | head -7; \
}; f"
EDIT: props to https://github.com/GitAlias/gitalias https://github.com/GitAlias/gitalias
- duskdozer 6mo agoCurious - why write it as a function in presumably .gitconfig and not just a git-summary script in your path? Just seems like a lot of extra escapes and quotes and stuff
- mattrighetti 6mo agoIt's a very old config that I copied from someone many years ago, agree that it's a bit hard to parse visually.
- deleted 6mo ago[deleted]
- Cthulhu_ 6mo agoNot the poster, but one theory: so you only need to copy one file. Portability.
- mr_mitm 6mo agoLooks like the above assumes a POSIX shell, so one could argue a dedicated script would actually be more portable.
- deleted 6mo ago[deleted]
- TonyStr 6mo agoLooks nice. Unfortunately I don't have log-of-count-and-email, log-of-count-and-day or churn
- petey283 6mo ago+1 Same. Edit. https://github.com/mattrighetti/dotfiles/blob/master/.gitconfig https://github.com/mattrighetti/dotfiles/blob/master/.gitcon...
- deleted 6mo ago[deleted]
- ape4 6mo agoYou could make a local `man` page.
- not_kurt_godel 6mo agoI was going to say, the OP's assertion that "they" are typing all these commands out by hand each time without an alias is just one of many tells that this post is AI slop. Nobody that proficient with shell commands should be typing any of those by hand more than once or twice without aliasing for reuse.