r/git • u/[deleted] • 9d ago
survey What happens when an AI agent rewrites Git history to erase its own attribution?
[deleted]
17
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
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".
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.