Live data from Hacker News

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

github.com

151–160 of 219 posts

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

#151
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…

I've recently implemented hooks that make it impossible for Claude to use tools that I don't want it to use. You could consider setting up a tool that errors if if they do an unsafe use of sed (or any use of sed if there are safer tools).

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

#152
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…

Even just last week I auto approved a plan and it even wrote the commit message for me (with @ClaudeCode signed off) which I am grateful my manager did not see.

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

#153
post #144

Earlier quoted context omitted.

Sounds like you care about data stored on your filesystem! Take one step back and solve that problem. Use a proper isolated sandbox, e.g. Github workspace on an account that is working with a fork. Care about the data in that workspace? Push it first. Othwerwise it is a cat and mouse game of whackamole.

Does any one of this help me if Claude runs `git reset --hard`? If I am working in a sandbox, I have uncommitted changes in a sandbox and if Claude runs `git reset --hard` on those uncommitted changes in the sandbox, I've got the same problem? > Care about the data in that workspace? Push it first. But you're changing the problem. If I push everything, then yeah I've got no problem. But between pushing one change and…

Ok I contest. If you are worried about it resetting it's own work then yes. Although just chuck the same prompt and you should get a similar result amirite? Maybe a better one lol!

Also you can instruct it to commit and push at every step too.

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

#154
post #90

Earlier quoted context omitted.

I agree that it should be left as a double hyphen, but an en dash is far more appropriate considering the decades-long precedent set by LaTeX (and continued by Typst).

It's a command line argument. The undeniably correct way to render it is with two minus signs[1] and absolutely not something non-ascii. [1] Not strictly a hyphen, which has its own unicode point (0x2010) outside of ascii. Unicode embraced the ambiguity by calling this point (0x2d) "HYPHEN-MINUS" formally, but really its only unique typographic usage is to represent subtraction.

The "sed" expressions that power the title "cleanup" here do overshoot quite often. It ruins --long-command-arguments and it definitely also reuins cpp::namespaces. Quite curious why these obvious shortcomings are not being fixed.

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

#155
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…

"DO NOT, EVER, UNDER ANY CIRCUMSTANCES, think of an elephant"

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

#157
post #108
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…

Why do you expect that a weighted random text generator will ever behave in predictable way? How can people be so naive as to run something like Claude anywhere other than in a strictly locked down sandbox that has no access to anything but the single git repo they are working on (and certainly no creds to push code)? This is absolutely insane behavior that you would give Claude access to your GitHub creds. What happ…

> How can people be so naive as to run something like Claude anywhere other than in a strictly locked down sandbox that has no access to anything but the single git repo they are working on (and certainly no creds to push code)?

Because it is much easier to do and failure rate is quite low.

(not saying that it is a good idea)

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

#158
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…

Maybe stop using the CLAUDE.md to prevent it from running tools you don't want it to and just setup a hook for pretooluse that blocks any command you don't want. Its trivial to setup and you could literally ask claude to do it for you and never have any of these issues ever again. Any and all "I don't want it to ever run this command" issues are just skill issues.

How that stops Claude from removing hook and then running command anyway?

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

#159

Earlier quoted context omitted.

Surely its copy and paste though?

You underestimate just how annoying iOS autocomplete can be.

I really don’t! I switched it all of months ago - autocomplete, autocaps, all of it. I reached a point where the constant frustration had to be worse than any productivity gain it was hoping to offer.

A few months on… I like it! Frustration is all gone, any errors are just on me now, and it forces me to slow down a bit and use the brain a bit more!

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

#160

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

But different projects are being reset at different times.

That's consistent with /loop command.
Post reply on HN