Combine git log --stat with status-name?

I have two git log aliases: one to show --name-status :

 ... | A path/to/yourfile.c | M path/to/myfile.c | M path/to/my/otherfile.c ... 

and one to show --stat :

 ... | path/to/yourfile.c | 2 ++ | path/to/myfile.c | 2 +- | path/to/my/otherfile.c | 27 +++++----- ... 

Is it possible to combine the two?

 ... | A path/to/yourfile.c | 2 ++ | M path/to/myfile.c | 2 +- | M path/to/my/otherfile.c | 27 +++++----- ... 

I like the --stat review, but it does not tell me whether files have been added or deleted; they were just somehow changed.

(When two command line flags are combined, --stat ignored.)

+7
source share
2 answers

I don't know how to combine --stat and --name-status , but you can use git log --stat --summary to get a list of added / deleted / renamed / copied files in addition to diffstat.

+7
source

I had a similar idea for git status and git diff --stat . Someone helped me come up with:

 git status | sed -e "$(git diff --stat | sed -e 's#/#\\/#g' | awk '/\|/ {print "s/" $1 "/" $0 "/;"}')" 

I tried replacing it with your git log commands, but they are too long (due to being unloaded). If you shorten your log with -n5 (show only the last 5 commits), this is a good start

 git log --name-only -n5| sed -e "$(git log --stat -n5 | sed -e 's#/#\\/#g' | awk '/\|/ {print "s/" $1 "/" $0 "/;"}')" 
0
source

All Articles