Today I Learned
Search…
Parsing `git status` for tracked & untracked changes
Posted on 15 Mar, 2021

Get count of untracked changes βž•οΈ (new files)

1
git status --porcelain | grep -c "??\s"
Copied!

Get count of tracked "deleted" files

1
git status --porcelain | grep -c "AD\s"
Copied!

Get count of modified files

1
git status --porcelain | grep -c "M\s"
Copied!

Get count of tacked changes

1
git status --porcelain | grep -c "A\s"
Copied!