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

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

git status --porcelain | grep -c "??\s"

Get count of tracked "deleted" files

git status --porcelain | grep -c "AD\s"

Get count of modified files

git status --porcelain | grep -c "M\s"

Get count of tacked changes

git status --porcelain | grep -c "A\s"
Copy link
Edit on GitHub
On this page
Get count of untracked changes βž•οΈ (new files)
Get count of tracked "deleted" files
Get count of modified files
Get count of tacked changes