Parsing git status for tracked & untracked changes

January 18, 2025 · View on GitHub

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"

Contents

  1. 1Get count of untracked changes ➕️ (new files)
  2. 2Get count of tracked "deleted" files
  3. 3Get count of modified files
  4. 4Get count of tacked changes