git-add-u-after-async-post-commit-hooklisted
Install: claude install-skill wan-huiyan/agent-traffic-control
# `git add -u` after async post-commit hook stages tracked-file deletions
## Problem
You make a clean commit. The project's post-commit hook prints something like:
```
[post-commit] Python files changed — running doc update in background...
```
You then need to amend the commit (typo in message, wrong issue reference, etc.).
You reach for the muscle-memory sequence:
```sh
git add -u && git commit --amend -m "..." # ← TRAP
```
The amend output reports something terrifying:
```
[your-branch 480e2226] fix(...): your message
1493 files changed, 4 insertions(+), 368977 deletions(-)
delete mode 100644 .claude-memory/MEMORY.md
delete mode 100644 .claude-memory/SESSION_CHECKPOINT_*.md
delete mode 100644 scripts/...
...
```
If you immediately ran `git push --force-with-lease`, that catastrophe is now
on the remote branch. The remote PR diff shows thousands of unrelated deletions
mixed with your intended 6-file fix.
`git status` afterwards reveals the smoking gun — files that WERE tracked before
the amend now show as **Untracked**:
```
On branch your-branch
Your branch is up to date with 'origin/your-branch'.
Untracked files:
.claude-memory/
.cursor/
.github/
MEMORY.md
PRODUCT.md
scripts/
```
## Why it happens
The async post-commit hook fires after your *first* commit and starts a background
process that:
1. Reads tracked files (e.g. `MEMORY.md`, `docs/site/*.html`).
2. Regenerates / renames / moves / deletes them as