This article explains how to scan only the files that changed using the --changed-only flag, giving fast feedback on pull requests. It is for developers and CI engineers who want quick, focused scans.
Overview
A full scan analyzes the whole project. On a large repository that can be more than you need for a single change. --changed-only narrows the scan to what changed, which keeps pull request feedback fast.
Step-by-step
Scan only the changed files:
vg scan --changed-only
This is well suited to a pull request check where you care about the drift introduced by the change, not a re-evaluation of the entire codebase.
When to use it
- Pull request pipelines where speed matters and you want feedback scoped to the change.
- Iterative local development when you want a quick read after editing a few files.
For a complete picture, periodically run a full scan (bare vg) and capture a baseline so trend and budget gates reflect the whole project. Use --changed-only for fast per-change feedback and full scans for the authoritative DriftScore.
Combining flags
You can pair --changed-only with gates such as --fail-on so a focused scan still blocks risky changes, and with --format to control the output.
Related
See the scan performance and caching guide, the combining scan with baseline guide, the failing on severity guide, and the scan command reference.