Live data from Hacker News

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

github.com

91–100 of 219 posts

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

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

When will you all learn that merely "telling" an LLM not to do something won't deterministically prevent it from doing that thing? If you truly want it to never use those commands, you better be prepared to sandbox it to the point where it is completely unable to do the things you're trying to stop.

My point is exactly that you need safeguards. (I have VMs per project, reduced command availability etc). But those details are orthogonal to this discussion.

However "Telling" has made it better, and generally the model itself has become better. Also, I've never faced a similar issue in Codex.

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

#92

Earlier quoted context omitted.

Surely its copy and paste though?

You underestimate just how annoying iOS autocomplete can be.

Not just iOS but macOS too. And it seems to only get worse. And with no notice to users. And no response in their forums.

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

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

[deleted]

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

#94

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

I opened up Hacker News and I saw this right at the top, and I assumed it had started happening to everyone. I thought, good thing I'm not running Claude Code right now.

I thought, good thing I've already hit my 5-hour session limit.

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

#96

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.

The rules and permissions are no longer program flags, but plain text for the agent to "obey".

That's not what tool use permissions are. The LLM doesn't just magically spawn processes or run code. The Claude Code program itself does those things when the LLM indicates that it wants to. The program has checks and permissions whether those things will be done or not.

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

#97
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.

I was on one till recently, maybe I still am. But does it work for orgs? I put some projects under orgs when they become more than a few projects.

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

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

Claude tends to disregard "NEVER do X" quite often, but funnily enough, if you tell it "Always ask me to confirm before going X", it never fails to ask you. And you can deny it every time

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

#99
post #39

> 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.

eBPF is a great tool to use for debugging this kind of thing too, e.g. [bpftrace]( https://bpftrace.org ) has an [execsnoop]( https://github.com/bpftrace/bpftrace/blob/master/tools/execs... ) script for looking at everything being exec'd on the system :-) (No need to use bpftrace, just an easy example :-) )

Or just `strace`.

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

#100
post #56

Earlier quoted context omitted.

you might be right, but consider the implications, if context can be corrupted in 0.1% cases and it starts showing another destructive behaviour, after creating 1000 tickets to agent, your data might be accidentally wiped off

I'd been using cursor at work for a year or two now, figured I'd try it on a personal project. I got to the point where I needed to support env-vars, and my general pattern is `source ./source-me-local-auth` => `export SOME_TOKEN="$( passman read some-token.com/password )"` ...so I wrote up the little dummy script and it literally just says: "Hrm... I think I'll delete these untracked files from the working directory…

Like a decade or more ago I remember a joke system that would do something random with the data you gave it, and you'd have to use commands like "praise" and "punish" to train it to do what you wanted. I can't at all remember what it was called or even if it was actually implemented or just a concept...
Post reply on HN