logoalt Hacker News

Claude Code runs Git reset –hard origin/main against project repo every 10 mins

201 pointsby mthwsjc_yesterday at 10:15 PM134 commentsview on HN

Comments

kibwentoday at 12:49 AM

Let's focus on the real issue here, which is that HN has apparently normalized the double hyphen in the title to an en dash--yes, an en dash, not even an em dash.

show 10 replies
Jarredtoday at 1:33 AM

I spent some time investigating this, and the issue is not accurate - Claude Code itself does not have code that spawns `git reset --hard origin/main`

Most likely, the developer ran `/loop 10m <prompt>` or asked claude to create a cron task that runs every 10 minutes and refreshes & resets git.

kccqzytoday at 12:24 AM

> Process monitoring at 0.1-second intervals found zero git processes around reset times.

I don’t think this is a valid way of checking for spawned processes. Git commands are fast. 0.1-second intervals are not enough. I would replace the git on the $PATH by a wrapper that logs all operations and then execs the real git.

show 2 replies
simianwordstoday at 12:06 AM

I think this post potentially mischaracterises what may be a one off issue for a certain person as if it were a broader problem. I'm guessing some context has been corrupted?

show 6 replies
lambdatoday at 1:28 AM

Who would have guessed that running a binary blob dev tool, that is tied to a SaaS product, which was mostly vibe-coded, could lead to mysterious, hard to debug problems?

luxurytenttoday at 12:03 AM

Not sure I understand, wouldn't permissions prevent this? The user runs with `--dangerously-skip-permissions` so they can expect wild behaviour. They should run with permissions and a ruleset.

show 3 replies
1123581321today at 3:26 AM

This looks similar to a bug report Claude Code offered to file for me after it became confused about my shell environment. The author is probably running something (maybe /loop as suggested in the comment.) In my case, a restart fixed the envs.

mememememememotoday at 12:43 AM

As a side note. Always configure remote to reject any kind of trunk push. And ideally any forced push on branches.

show 1 reply
nstjtoday at 2:15 AM

As an FYI you can recover from force pushes to GitHub using their UI[0] or their API[1].

And if you force push to one of your own machines you can use the reflog[2].

[0]: https://stackoverflow.com/a/78872853 [1]: https://stackoverflow.com/a/48110879 [2]: https://stackoverflow.com/a/24236065

byearthithatiustoday at 12:28 AM

Regardless of if this is common its getting popular because its objectively hilarious and we can all see it being possible.

Ryand1234today at 3:21 AM

This is exactly why guardrails need to be deterministic and outside the model.

ghelmertoday at 12:07 AM

That is not my experience.

show 2 replies
oelmgrentoday at 12:12 AM

I'm curious how common this is or if this just affects this one user.

show 1 reply
jrvarela56yesterday at 11:52 PM

It’s a feature not a bug!

rkrbaccord94ftoday at 2:45 AM

95+ entries that are logged at 10 min intervals

/10 * * * /usr/ schedules script execution

simonwtoday at 2:47 AM

Has anyone been able to replicate the behavior described in this issue yet?

nerolawatoday at 2:16 AM

Highly recommend to deny commands in user settings.json like git reset

chaos_emergenttoday at 12:49 AM

Have you considered that Claude set up a crontab that does that programmatically? Every 10 mins seems awfully, idk, regular.

show 1 reply
jxcoletoday at 12:45 AM

The obvious solution is to just copy paste it into Claude itself and ask it to fix. Works for almost any Claude problem

simianwordsyesterday at 11:46 PM

Prompt injection?

show 1 reply
lqstuarttoday at 1:58 AM

if an idea can't be vibecoded in under 10 minutes, it's not worth pursuing. Checks out

whateveraccttoday at 12:00 AM

that must be a very powerful claude.md

meltynesstoday at 12:29 AM

is this token friendly?

meander_watertoday at 12:03 AM

Probably does it to reduce context for regex/git history searches

gverrillatoday at 2:03 AM

obviously a user mistake, not a claude code bug

dborehamtoday at 1:38 AM

But it doesn't.

fragmedetoday at 12:15 AM

While that's obviously a bug which should be fixed, having stuff just sitting around uncommitted for days (which is much longer than 10 mins) is an anti-pattern (that I used to fall into).

TZubiritoday at 12:08 AM

tbf, that's claude's workspace

do not share a workspace with the llm, or with anybody for that matter.

How would the llm even distinguish what was wrote by them and what was written by you ?

irishcoffeetoday at 12:32 AM

I’m having this weird vision of a “the matrix 3” type machine crawling around inside Microsoft’s GitHub servers central repository and just wreaking havoc.

This whole LLM thing is a blast, huh?

nickphxyesterday at 11:58 PM

cool. if you choose to use a non-deterministic black box of bullshit, should you really be surprised when it shits all over your floor?

show 3 replies
imta71770today at 1:54 AM

[dead]

MeetRickAItoday at 12:15 AM

[dead]

ryguztoday at 12:36 AM

[dead]

mistMyesterday at 11:23 PM

[dead]

xorgunyesterday at 11:31 PM

[dead]

draw_downtoday at 12:13 AM

Hope they don’t auto-close this one in two weeks

claudiugtoday at 12:05 AM

no more developers, all code is written alone /s

show 1 reply
BoorishBearsyesterday at 11:28 PM

Truly is a brave new world we're in

-

I guess some people are upset at my brave new world characterization, but even as someone deriving value from Claude Code we've jumped the shark on AI in development.

The idea a natural request can get Claude to invoke potentially destructive actions on a timer is silly

https://code.claude.com/docs/en/scheduled-tasks#set-a-one-ti...

What would it cost if the /loop command was required instead of optional?

throw5today at 12:00 AM

Isn't this a natural consequence of how these systems work?

The model is probabilistic and sequences like `git reset --hard` are very common in training data, so they have some probability to appear in outputs.

Whether such a command is appropriate depends on context that is not fully observable to the system, like whether a repository or changes are disposable or not. Because of that, the system cannot rely purely on fixed rules and has to figure intent from incomplete information, which is also probabilistic.

With so many layers of probabilities, it seems expected that sometimes commands like this will be produced even if they are not appropriate in that specific situation.

Even a 0.01% failure rate due to context corruption, misinterpretation of intent, or guardrail errors would show up regularly at scale, that is like 1 in 10000 queries.

show 1 reply
boutellyesterday at 11:30 PM

That's interesting man, that's pretty f***' interesting. I don't think I've seen it though. I've let it run for hours making changes overnight and I only do git operations manually.

Oh, but maybe allowing it to do remote git operations is a necessary trigger.