Version control manages successive states of files and other artifacts. In AI-assisted development, it records changes, preserves working versions, and gives coding assistants reliable context for understanding a project. section 6.11 section 11.9.1
Use version control with AI assistants to:
- Compare working and broken implementations instead of repeatedly modifying a failing solution. section 11.9.1
- Let the assistant study a branch with working code, return to the active branch, and apply the learned implementation pattern. section 11.9.1
- Pair changes with tests and project-wide quality rules so refactoring remains within defined boundaries. section 11.9 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 a three-step Git workflow: obtain working code, have the assistant analyze its pattern, then implement the fix on the active branch. section 11.9.1
























