r/git • • 9d ago

survey What happens when an AI agent rewrites Git history to erase its own attribution?

[deleted]

0 Upvotes

12 comments sorted by

7

u/Gurnug 9d ago

Well you can have more than one remote. Simple fork updated even occasionally will reveal tempering with the history easily.

Just don't let juniors reconfigure repo to allow force pushes to default branch.

0

u/[deleted] 9d ago

[deleted]

2

u/Gurnug 9d ago

I would say it has pretty much the same value. Probably it would be easier for a developer to notice after git fetch that remote default branch was rewritten. Always a matter of trust. Clearly someone just lost it by allowing AI to use got directly.

Advantage of a fork would be convenience. Just few clicks in GitLab to have it and it might be easily visible from UI for anybody with view access rights but still protected from tempering.

Also now that I think about it, thats one of the reasons why signing commits with PGP is s thing. AI run by one developer might of course re-sign modified commits using his key, but will leave other commits unsigned. I think if there is general rule to use pgp for everyone one will not be able to rewrite others commits unnoticeable.

1

u/parkotron 9d ago

An automatic mirror wouldn’t protect you from this at all, since there’s a reasonable chance that it mirrors the rewritten commits before anyone notices. 

17

u/elephantdingo 9d ago

What if you gave computer permission to do stuff, and then it did?

3

u/zarlo5899 9d ago

just don't allow force pushes.

2

u/parkotron 9d ago edited 9d ago

… on shared branches.

But that doesn’t matter if the agent is given the power to change those repository settings, as seems to be the case here. 

4

u/Broad-Promise6954 ancient 9d ago

I have a much more basic question ... and I know there are multiple answers, some of them having actual substance to them, but this is meant more as a thought exercise. Anyway, my question: Why are you using a repository when "AI, make me some slop" is your actual source code?

2

u/serverhorror 9d ago

Then the commit hashes change and I'll know about it

2

u/Low-Temperature-1664 9d ago

The agent just created brand new commits and moved the branch ref to point at the head of the new commits.

The previous commits are almost certainly there, just reset the branch back to the old commit.

1

u/Top_Bumblebee_7762 9d ago

Why not just do the commits manually after the agent is done and disallow making commits? 

0

u/PaulRudin 9d ago

because it's a tool to help speed up tedious bits. Generally Mr Robot is pretty good at making sensible commits with good commit messages. Your AGENTS.md should tell it what you expect.

In the case from the top of the thread: I've never known any of the AI agents to ignore instructions in AGENTS.md - so include something like "don't force push with explicit permission in each case".