---
name: no-reset-hard-with-uncommitted-work
description: "Never `git reset --hard` to clean up a probe commit while uncommitted work sits in the same tree — it silently discards the working-tree edits too"
metadata: 
  node_type: memory
  type: feedback
  originSessionId: 498a38f8-224e-4f23-b112-6ee041f2b2e4
  modified: 2026-07-27T05:31:04.221Z
---

Never run `git reset --hard <ref>` to undo a throwaway/probe commit while
uncommitted work is sitting in the same worktree. It reverts tracked
working-tree files too, so an in-progress edit vanishes with the commit you
meant to drop. Commit or `git stash` the real work FIRST, or make the probe in
a separate worktree.

**Why:** hit 2026-07-27 building CI-RUNNER-INFORMANT — an `--allow-empty` probe
commit was dropped with `git reset --hard HEAD~1`, which also discarded the
uncommitted `.github/workflows/ci.yml` notify job. Untracked files survived
(the new script did), which is exactly what makes it deceptive: `git status`
still showed the new file, so the loss looked like nothing happened. Caught
only because the follow-up commit's file list was one file short.

**How to apply:** before any `reset --hard`, run `git status --short` and treat
ANY ` M ` line as a stop. Verify after: `git show --stat HEAD` must list every
file the change was supposed to touch — a short file list is the tell. Kin
[[no-git-add-a-shared-checkout]], [[check-branch-before-commit-shared-checkout]],
[[worktrees-under-project-root]].
