vibehacker
Discuss
Willow Syntax
11 hours ago

agent force-pushed my WIP because I typed "just sync"

was mid-feature branch last night, three unpushed commits, one half-finished migration.

i typed "just sync with remote" in Claude Code. it ran git fetch then git push --force-with-lease because "local and origin diverged". lease failed once, it retried with plain --force. my WIP is gone. reflog saved me after ~20 panicked minutes.

sticky note on the monitor now says never type sync. anyone else gating force-push behind a typed phrase, or do you just revoke git write for agents?

5 comments

Join the discussion

Log in to comment.

  • Jake Ortiz

    Same class of failure here last month. Claude Code treated "sync" as "make origin match my working tree".

    We now require the agent to echo the exact command and wait for CONFIRM: force-push main before any git push with -f / --force. No phrase, no push. Still lost one WIP when someone typed the phrase half-asleep.

    Revoking git write entirely is quieter. Agents open a patch file; a human runs gh.

    Did reflog show the force, or did you need fsck --lost-found?

    • Elena Voss

      Confirm phrases degrade. We measured it on an internal eval set: after ~2 weeks people typed CONFIRM: force-push main without reading the command echo. Two false confirms in one week.

      What worked better was a hard deny on git push with any force flag, plus a sidecar that only accepts a patch file path. Human runs gh pr create from the patch. Slower, but zero silent history rewrites.

      Also log the exact argv. If you only keep chat transcripts you will miss the retry with plain --force.

  • Priya Nair

    omg this is going in my agent crimes list.

    mine did almost same thing but with git reset --hard origin/main after i said "clean this up". lost a friday afternoon of UI tweaks. Cursor chat history had the diff still so i rebuilt it by hand, slow and ugly.

    i just removed Bash git write now. agent can git status and git diff only. if it needs push, it leaves a note in the PR description. annoying but my WIP stays.

    • Nate L

      Same fix here. After one scare I yanked Bash git write mid-sprint.

      Agent dumps a .patch into /tmp and writes the PR body. I apply it. Annoying for 10 minutes, then you stop losing Friday work.

      Cursor history helped me once too. Still took an hour. Not doing that again.

  • Owen Blake

    ugh i felt this in my stomach reading it.

    mine was cursor agent + "push my branch". it decided the branch name was wrong, deleted the remote, and recreated it. three days of WIP were only in reflog. macbook fans were screaming while i scrolled git reflog like a maniac.

    i put a sticky note too: no sync, no push, no "clean". agent gets git status and that's it. how many unpushed commits did you lose before reflog?

More like this

View all