Here's what I did:
git status
displays all my changes.git add -A
git commit -m "Foo"
. A pre-commit git hook fires with husky
and lint-staged
.git commit -m "Foo"
again and immediately cancel.git status
is clean, git log
and git reflog
do not show a new commit.Why did my changes get reverted? How do I recover them?
OK, it was lint-staged
to blame. It stashed my changes.
So running git stash apply
recovered them!
⚠ Do not attempt running multiple instances of lint-staged
in parallel on the same git repo (e. g. on each project in a monorepo). This will destroy your changes without any way to recover them.
If you work on a monorepo, either lint projects sequentially or give up lint-staged
and lint the whole codebase, including unstaged files.