Created
September 7, 2023 13:26
-
-
Save yhauxell/96e38893d5cf02b0a00d2f68c62db330 to your computer and use it in GitHub Desktop.
Get changes stats over current branch on git repos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function git_numstat_summary() { | |
CURRENT=$(git branch --show-current) | |
FILES=$(git diff --name-only main...HEAD | wc -l) | |
echo "Files changed" | |
echo "$FILES files" | |
echo "Lines changed" | |
git log --numstat --pretty="%H" main.."$CURRENT" | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}' | |
} | |
alias branchstats=git_numstat_summary |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment