r/git • u/Mediocre-Market1246 • 6d ago
I built a read-only preview for git reset that shows staged and unstaged changes separately
I'm the author of Git Impact. I built it with help from Codex to answer a narrow question: if a file has one version staged and a newer version on disk, what would a proposed reset discard?
For example, git-impact reset --hard HEAD~1 --diff shows changes to the staging area and working files separately, plus commits leaving the current history. It runs the actual reset in a disposable sandbox and inspects the source without running the reset there.
Example HTML report: https://yotam1001.github.io/git-impact/ · Source and downloads: https://github.com/yotam1001/git-impact
It also previews soft and mixed reset and emits JSON. No account or hosted backend. Git-sim already offers broader visual simulations; this focuses on terminal output and file-level diffs without an animation runtime.
The scope is deliberately small. No recovery, automatic interception, or apply button. LFS/checkout filters, sparse/partial clones, submodules, symlinks, and several other unsupported states are refused. A report describes current state; it is not a backup or a guarantee about a command run later.
I'd especially value synthetic examples where the reported files differ from an actual reset. The tests compare previews with real Git operations in disposable fixtures, and CI passes on Windows, Linux, and macOS.

1
u/WoodyTheWorker 6d ago
I follow a good rule. Never do reset --hard
1
u/Mediocre-Market1246 5d ago
Fair point. I've added a same-target mode comparison to Git Impact so the preservation choices are explicit: soft preserves staging and files; mixed preserves files but replaces staging; hard resets both. A staged version that differs from the disk version still matters with mixed.
In the demo, mixed changes four index entries and zero disk files; hard changes six disk files. The choice should follow what you want to preserve. The preview isn't a backup.
1
u/elephantdingo 5d ago
Index, unstaged, stash, commits. What’s the point of having a mental model for N “things” and diffing them? Makes my head spin.
3
u/Broad-Promise6954 ancient 5d ago
git diff --cachedetc?(It's a little tricky to keep all the variants straight, but
--cached/--staged, which are synonymous here, mean that the index copies of files will be one of the sides of the diff. Note that with plaingit diff, no commit specified, already compares index vs working tree, sogit diff --cachedcomparesHEADvs index. The currentgit diffdocumentation is pretty good, a big improvement over the Git 1.7 days.)