Live data from Hacker News

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

github.com

71–80 of 219 posts

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

#71
post #70
post #64

Earlier quoted context omitted.

It's not a one off issue - it has happened to me a few times. It has once even force pushed to github, which doesn't allow branch protection for private personal projects. Here's an example. 1) claude will stash (despite clear instructions never to do so). 2) claude will use sed to bulk replace (despite clear instructions never to do so). sed replacements make a mess and replaces far too many files. 3) claude restore…

Reinforcing an avoidance tactic is nowhere near as effective as doing that PLUS enforcing a positive tactic. People with loads of 'DONT', 'STOP', etc. in their instructions have no clue what they're doing. In your own example you have all this huge emphasis on the negatives, and then the positive is a tiny un-emphasized afterthought.

I think you're generally correct, but certainly not definitively, and I worry the advice and tone isn't helpful in this instance with an outcome of this magnitude.

(more loosely: I'm a big proponent of this too, but it's a helluva hot take, how one positively frames "don't blow away the effing repro" isn't intuitive at all)

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

#72

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.

Who knows whether permissions would prevent this? Anthropic's documentation on permissions ( https://code.claude.com/docs/en/permissions ) does not describe how permissions are enforced; a slightly uncharitable reading of "How permissions interact with sandboxing" suggests that they are not really enforced and any prompt injection can circumvent them.

With hooks you can enforce permissions much more concretely.

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

#73
post #65
post #62

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.

iOS keyboard autocomplete

Surely its copy and paste though?

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

#74
post #64

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?

It's not a one off issue - it has happened to me a few times. It has once even force pushed to github, which doesn't allow branch protection for private personal projects. Here's an example. 1) claude will stash (despite clear instructions never to do so). 2) claude will use sed to bulk replace (despite clear instructions never to do so). sed replacements make a mess and replaces far too many files. 3) claude restore…

It has once even force pushed to github, which doesn't allow branch protection for private personal projects.

This is only restricted for *fully free* accounts, but this feature only requires a minimum of a paid Pro account. That starts around $4 USD/month, which sounds worth it to prevent lost work from a runaway tool.

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

#76
post #44

Earlier quoted context omitted.

Yes, exactly. People often overlook that, even with guardrails, it is still probabilities all the way down. You can reduce the risk, but not drive it to zero, and at scale even very small failure rates will surface.

I'm not sure what the argument is here. 1. if the problem the post is suggesting is common enough, it is a bug and the extent needs to reduce (as you said) 2. if it is not common and it happens only for this user, it is not a bug and should be mostly ignored Point is: the system is not something that is inherently a certain way that makes it unusable.

> and it happens only for this user, it is not a bug and should be mostly ignored

What if it happens for two users? (Still "not common").

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

#77

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

This! The safeguards need to be outside LLM and they need to be deterministic.

Now I wish I could reject `git reset --hard` on my local system somehow.

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

#78

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?

I mean its a skill issue in the sense that Claude Code gives you the tools to 100% deterministically prevent this from ever happening without ever relying on the models unpredictability.

Just setup a hook that prevents any git commands you don't ever want it to run and you will never have this happen again.

Whenever I see stuff like this I just wonder if any of these people were ever engineers before AI, because the entire point of software engineering for decades was to make processes as deterministic and repeatable as possible.

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

#79
post #62

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.

And it should be "--" to begin with, i.e. "--hard".

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

#80
post #64

Earlier quoted context omitted.

It's not a one off issue - it has happened to me a few times. It has once even force pushed to github, which doesn't allow branch protection for private personal projects. Here's an example. 1) claude will stash (despite clear instructions never to do so). 2) claude will use sed to bulk replace (despite clear instructions never to do so). sed replacements make a mess and replaces far too many files. 3) claude restore…

It has once even force pushed to github, which doesn't allow branch protection for private personal projects. This is only restricted for *fully free* accounts, but this feature only requires a minimum of a paid Pro account. That starts around $4 USD/month, which sounds worth it to prevent lost work from a runaway tool.

That's a fee for not running a local git proxy with permissions enforcement that holds onto the GitHub credentials in place of Claude.
Post reply on HN