Reputation: 3558
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.
Upvotes: 4
Views: 2824
Reputation: 31
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
Upvotes: 0
Reputation: 17071
Try this:
git status -s | awk '{print $2}' \
| sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' \
| uniq -c
Where:
awk '{print $2}'
- match updated files
sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/'
- extract file extension
uniq -c
- calcalate count
Upvotes: 2