Git is a distributed version control system that records file changes. With AI assistants, it also provides working code and earlier implementations that help guide repairs. section 11.9.1
When an AI-generated change breaks authentication, discard the broken work, switch to a branch where the feature works, and ask the assistant to study that implementation. Return to the active branch and request a fix based on the learned pattern. This gives the assistant a clean comparison instead of repeated variations of faulty code. section 11.9.1
Table 11.4 Using Git with AI
|
Step
|
Actual prompt used
|
|---|---|
|
Get working code
|
Your changes broke authentication so I’ve discarded them. This is a persistent bug. To address it, I’d like you to learn from another branch that has a working version. I’m going to switch to that one so that you can learn from it. Ready?
|
|
Learn the pattern
|
Okay done. I’m now on a branch with working code. Please analyze the code to see what went wrong with your changes.
|
|
Fix the problem
|
Now I’m back on our active branch. Again, I removed your previous changes. Please implement working auth using the patterns you just learned.
|
Follow the three-step workflow: retrieve working code, analyze its pattern, then implement the fix on the active branch. section 11.9.1







