Git status summary by file extension

Viewed 2443

Is there a possibility to change the output of git status, so that is shows only one line per file extension? e.g,

M *.java -> 12
D *.html -> 2
M *.md -> 1

I am on Unix, so some grep magic would do as well.

2 Answers

The better is to add sort, because files can be in different folders

git status -s | awk '{print $2}'     \
          | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/'  \
          | sort   \
          | uniq -c
Related