Resolving Your First Conflict

Both real conflicts, resolved by hand. git status confirms exactly what's left, every step of the way.

The two real conflicts from the last lesson are still sitting there, genuinely unresolved. Resolving one by hand means editing the file to remove the markers and decide what the real, final content should say — often combining both sides' intent rather than simply picking one.\n\ngit status is the real, honest guide throughout: it tells you exactly which files still need attention, and exactly when every real conflict has genuinely been resolved and staged.

Resolving by Rewriting the Real, Final Content

printf '# Recipe Collection\n\nStatus: published (config tweaks pending final review)\n' > README.md
printf '{\n  "servings_default": 6,\n  "unit_system": "imperial"\n}\n' > config.json

Both real intents genuinely combined: keeping "published" but noting the pending review, keeping the new servings count with the newer unit choice — a real, considered decision, not an arbitrary pick.

Staging, and Watching git status Update

git add README.md config.json
git status

"All conflicts fixed but you are still merging" — a real, honest progress report: the hard part is done, but the merge itself is not committed yet.

Completing the Real Merge

git commit --no-edit

Reuses the original "Merge pull request: config tweaks" message from the failed merge attempt — a real, completed merge commit results.

Cleaning Up Immediately

git branch -d feature/config-tweaks
git push origin --delete feature/config-tweaks

The same real discipline from Block 2.2 — nothing stale left behind the moment the feature is safely, fully merged.

Resolving by hand

Editing a conflicted file directly to remove the markers and write the real, final intended content — often combining both sides rather than choosing one. Confirmed directly in this lab: both README.md and config.json ended up with elements from both the master and incoming versions.

git commit --no-edit (completing a merge)

Once every conflict is staged, a plain commit completes the merge — --no-edit reuses the message already set when the merge was first attempted. Confirmed directly in this lab producing a real merge commit with both original parents.

👀 Confirm the Starting Point

Re-check git status to see the exact same real conflict from the last lesson, still waiting.

cd ~/team-recipes && git status

student@lab:~$ cd ~/team-recipes && git status On branch master Your branch is up to date with 'origin/master'. You have unmerged paths. (fix conflicts and run "git commit") (use "git merge --abort" to abort the merge) Unmerged paths: (use "git add <file>..." to mark resolution) both modified: README.md both modified: config.json no changes added to commit (use "git add" and/or "git commit -a")

✏️ Resolve Both Files by Hand

Rewrite each file with the real, final content — combining both sides' genuine intent.

cd ~/team-recipes && printf '# Recipe Collection\n\nStatus: published (config tweaks pending final review)\n' > README.md
cd ~/team-recipes && printf '{\n  "servings_default": 6,\n  "unit_system": "imperial"\n}\n' > config.json
cd ~/team-recipes && git add README.md config.json
cd ~/team-recipes && git status

student@lab:~$ cd ~/team-recipes && printf '# Recipe Collection\n\nStatus: published (config tweaks pending final review)\n' > README.md student@lab:~$ cd ~/team-recipes && printf '{\n "servings_default": 6,\n "unit_system": "imperial"\n}\n' > config.json student@lab:~$ cd ~/team-recipes && git add README.md config.json student@lab:~$ cd ~/team-recipes && git status On branch master Your branch is up to date with 'origin/master'. All conflicts fixed but you are still merging. (use "git commit" to conclude merge) Changes to be committed: modified: README.md modified: config.json

✅ Complete the Real Merge

Commit the resolution, completing the merge for real.

cd ~/team-recipes && git commit --no-edit
cd ~/team-recipes && git push

student@lab:~$ cd ~/team-recipes && git commit --no-edit [master e6c2e02] Merge pull request: config tweaks student@lab:~$ cd ~/team-recipes && git push Enumerating objects: 10, done. Counting objects: 100% (10/10), done. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 495 bytes | 45.00 KiB/s, done. Total 4 (delta 1), reused 0 (delta 0), pack-reused 0 To ../recipes-origin.git 60dea42..e6c2e02 master -> master

🗑️ Clean Up Immediately

The feature is safely, fully merged — remove the now-redundant branch, both copies.

cd ~/team-recipes && git branch -d feature/config-tweaks
cd ~/team-recipes && git push origin --delete feature/config-tweaks
cd ~/team-recipes && git log --oneline -3

student@lab:~$ cd ~/team-recipes && git branch -d feature/config-tweaks Deleted branch feature/config-tweaks (was 9f69af9). student@lab:~$ cd ~/team-recipes && git push origin --delete feature/config-tweaks To ../recipes-origin.git - [deleted] feature/config-tweaks student@lab:~$ cd ~/team-recipes && git log --oneline -3 e6c2e02 (HEAD -> master, origin/master, origin/HEAD) Merge pull request: config tweaks 60dea42 Switch default units to imperial f92e286 Mark README as published

Lab 2.4.2 complete. A real conflict, resolved by hand, staged, and genuinely completed:\n\n\n Both files resolved by hand : ✅ real, combined intent\n Staged and confirmed : ✅ git status\n Merge completed : ✅ real commit\n Branch cleaned up : ✅ local + remote\n

Enable JavaScript to run the live terminal and track your progress.