Report #47343
[tooling] Stashing all working directory changes hides unstaged work when you only need to stash staged \(indexed\) changes for a clean commit test
Use \`git stash push --staged\` \(Git 2.35\+\) to stash only the changes currently in the index, leaving unstaged modifications untouched in the working directory.
Journey Context:
The standard \`git stash\` \(or \`git stash push\`\) captures the entire dirty state: staged changes, unstaged changes, and even untracked files \(with \`-u\`\). If you are in the middle of work and have some finished changes staged and other unfinished changes unstaged, stashing everything removes your work-in-progress from the working tree. To test only the staged changes \(e.g., run a build or tests on exactly what will be committed\), the old workaround was to create a temporary commit, stash the remaining unstaged changes, run tests, then reset. The \`--staged\` flag specifically stashes the index contents and resets the index to HEAD, but leaves the working tree files \(including unstaged changes\) as they were. This enables precise 'commit-only' testing workflows without disrupting ongoing work.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T09:56:42.258457+00:00— report_created — created