#179 AI coding and productivity 6.6 min
Git Merge Conflicts: Check Before You Accept a Fix
Three one-click resolutions left no conflict markers, and each one still failed a test.
Read the conflict file
Copy the code folder first. Git must be installed. Run python run.py file. Find the line that starts with seven less-than signs, the line of equals signs, and the line with seven greater-than signs. Say which value of FREE_FROM comes from main and which from the feature branch. When I ran it, the HEAD part had FREE_FROM = 40 and the other part had FREE_FROM = 50 and the member line.
A hint
The top part is HEAD, the branch you are on. The bottom part is the branch you are merging.
Predict the five resolutions
Before running anything, predict how many of the 3 tests each of the five resolutions passes. Then run python run.py check and compare. When I ran it, as is passed 0 of 3, ours, theirs and both each passed 2 of 3, and by hand passed 3 of 3.
A hint
As is still has markers, so the file cannot run as code.
Write your own reason in the message
In run.py, change the text of WHY to a reason of your own. Run python run.py commit and find your sentence on the Why line of the commit message. When I ran it with my own sentence, the Why line showed it, and the Kept from lines were unchanged.
A hint
The video says the why has to come from a person, not from the diff.
Add a fourth test case
In checks.py, add a fourth case to CASES: ((10,), {"member": True}, 4.99), which is a member who spends 10 and still pays shipping. Predict the tests column for each resolution, then run python run.py check. When I ran it, as is passed 0 of 4, ours 2 of 4, theirs 3 of 4, both 3 of 4 and by hand 4 of 4.
A hint
A member needs 25 or more for free shipping, so 10 pays the 4.99 fee.
These tasks are for you to try on your own machine. Nothing is checked or saved.
What this does not show
One tiny made-up conflict in a temp repo; no AI tool is run, the three tests are my reading of each branch's intent, and the lost-lines check compares whole lines only.
Up next in AI coding and productivity
More in AI coding and productivity
- #20 AI Coding Assistant Workflow: Copy, Test, Read the Diff
- #169 Write Coding-Assistant Rules That Work
- #171 TDD With an AI Assistant: Red, Green, Refactor (unittest)
- #172 Refactor Safely With AI: Characterisation Tests (pytest)
- #173 Debug with AI: Give It a Traceback and a Minimal Repro
- #174 Review AI-Generated Code Fast: Checklist vs Bandit vs Tests
Related videos
- #171 TDD With an AI Assistant: Red, Green, Refactor (unittest) AI coding and productivity
- #173 Debug with AI: Give It a Traceback and a Minimal Repro AI coding and productivity
- #174 Review AI-Generated Code Fast: Checklist vs Bandit vs Tests AI coding and productivity
- #20 AI Coding Assistant Workflow: Copy, Test, Read the Diff AI coding and productivity
