That said, having a single option that rewinds LLM context and code state is better than having to do both separately.
Your tools should work for you, and git is no exception. Commit early and commit often. Before you (or an LLM) go on a jaunt through the code, changing whatever, commit the wip to git as you go along. That way, if something goes awry, it's an easy git reset HEAD^ to go backwards just a little bit and undo your changes.
Later on, when it's time to share your work, git rebase -i main (or wherever your branching off point was). This will bring up your editor with a list of commits. Reorder them to make more sense, and then also merge commits together by changing the first word on the line to be "fixup". exit your editor and git will rewrite history for outside consumption. Then you can push and ask someone else to review your commits, which hopefully is now a series of readable smaller commits and not one giant commit that does everything, because those suck to review.
- you DO want your prompts and state synced (going back to a point in the prompt <=> going back to a point in the code).
Git is a non starter then. At least the repo’s same git.
Plus, you probably don’t want the agent to run mutating git commands, just in case it decides to allucinate a push —force