Resolving a Conflict
A conflict happens when both branches change the same lines. Edit the file, git add it and commit.
Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
git switch -q -c feat
echo feat > a.txt && git commit -qam 'feat'
git switch -q main
echo main > a.txt && git commit -qam 'main'
git merge feat >/dev/null 2>&1; git status -s
echo resolved > a.txt && git add a.txt && git commit -qm 'Resolve'
git status -s | wc -lResult
UU a.txt 0
Exercise
Mark resolved.
git a.txt
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.