Lessons · Git · knowing you have finished resolving
Knowing you have finished
Two checks: git reports no unmerged paths, and no conflict marker is left in any file. Staging a file with markers still in it is entirely possible.
Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.
What it is for
A commit containing <<<<<<< is a real thing that happens, and it usually reaches a branch before anybody notices.
How to think about it
Look for the markers before you stage, not after. And build the project if you can: a resolution can be syntactically fine and semantically wrong.
Worked example
git merge featureStopped.
grep -c '<<<<<<<' f.txtOne marker. This is the check worth automating in your head.
echo both sides, properly > f.txtResolved by hand.
grep -c '<<<<<<<' f.txt || trueZero. Nothing left behind.
git add f.txtStaged.
git status --shortM, and no unmerged paths.
git commit -qm 'merge feature'And the merge is complete.
Your turn
Count the conflict markers left in the file.
grep -c f.txt
Try it in a real repository
The trap
Trusting that the editor showed you every conflict. A long file can have several, and the last one is usually the one that gets committed.