Skip to content

Analyse local changes

--local-changes analyses only the files that differ from the remote tracking branch: committed but not pushed, staged, unstaged and untracked. On a large project that gives you the metrics of your work in progress in seconds. Deleted files are included with empty metrics, so they can show as absent in the map.

The Unified Parser and the Raw Text Parser support the flag. The Dependency Parser rejects it, because the dependency graph needs every file of the project, and the Domain Language Parser accepts it without effect.

Terminal window
ccsh unifiedparser . -o changes.cc.json --local-changes
ccsh rawtextparser . -o changes.cc.json --local-changes

The flag combines with other options such as --exclude, --file-extensions or --bypass-gitignore, but not with --commit.

File stateIn the output
Changed (staged, unstaged, untracked, committed but not pushed)analysed with full metrics
Deletedincluded with empty metrics {}
Unchangedleft out

The parser finds the upstream branch with git rev-parse --abbrev-ref @{upstream}. Without one it stops with an error that tells you how to set it, for example git branch --set-upstream-to=<remote>/<branch>.

Terminal window
ccsh unifiedparser . -o full.cc.json # full analysis, run once or now and then
ccsh unifiedparser . -o changes.cc.json --local-changes # only your changes
ccsh merge full.cc.json.gz changes.cc.json.gz -o merged.cc.json

Output is gzip-compressed by default, so the merge reads the .gz files and writes merged.cc.json.gz.

  • The project folder is inside a git repository.
  • git is on the PATH.