Your laptop and GitHub now end in the same merge commit, and the back office catches up the next time it pulls. The last pull went through on its own because the two computers had changed different files. Sooner or later, though, two commits change the same line in different ways, and then Git stops and hands the decision to you.
In this lesson, you’ll make that happen on purpose in a throwaway copy of the project, where nothing you do can hurt the real site. You’ll read what Git shows you, back out once, and then resolve the conflict so that the file keeps both changes. Start by making the copy.
Make a Practice Copy With Two Competing Changes
To practice resolving a conflict, start with two known changes in a copy you can discard. So instead of experimenting in your laptop’s generic-grocery folder, make a third clone that you’ll never push and that you’ll delete after the next lesson.
In your laptop’s terminal, in the generic-grocery folder, move up one level and clone your repository into a new folder. Use your own repository’s HTTPS address, the one you cloned the back office from, with your GitHub login in place of the example’s made-up generic-grocery-dev:
$ cd ..
$ git clone https://github.com/generic-grocery-dev/generic-grocery.git generic-grocery-practice
Cloning into 'generic-grocery-practice'...
...
The remote: lines and the counts look like the ones from the back-office clone. Open generic-grocery-practice in its own VS Code window, with File → New Window and then File → Open Folder…, and open a terminal there. Like every fresh clone, generic-grocery-practice has no node_modules/ folder yet, so install the packages from the lockfile:
$ npm ci
added 16 packages, and audited 17 packages in 765ms
...
On macOS, npm blocks the fsevents install script here too, which you can leave unapproved as before.
Now set up two changes that compete for the same line. You won’t file issues for these practice changes, and the real store’s hours stay as they are. On a new branch, have the store open at 9 a.m. on New Year’s Eve instead of 7 a.m.:
$ git switch -c new-years-eve-open
Switched to a new branch 'new-years-eve-open'
In src/data/holidays.js, change only the open time on the line for New Year’s Eve, so that the line reads like this:
"2026-12-31": { name: "New Year's Eve", open: "09:00", close: "18:00" },
Commit the change, and then switch back to main:
$ git add src/data/holidays.js
$ git commit -m "Open at 9 a.m. on New Year's Eve"
[new-years-eve-open d356660] Open at 9 a.m. on New Year's Eve
1 file changed, 1 insertion(+), 1 deletion(-)
$ git switch main
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
Back on main, the store opens at 7 a.m. again. This time, change only the close time, so that the store closes at 4 p.m. instead of 6 p.m.:
"2026-12-31": { name: "New Year's Eve", open: "07:00", close: "16:00" },
Commit it on main too, and look at the history. The graph’s longest line is wrapped here for display:
$ git add src/data/holidays.js
$ git commit -m "Close at 4 p.m. on New Year's Eve"
[main 775b142] Close at 4 p.m. on New Year's Eve
1 file changed, 1 insertion(+), 1 deletion(-)
$ git log --oneline --graph --all -3
* 775b142 (HEAD -> main) Close at 4 p.m. on New Year's Eve
| * d356660 (new-years-eve-open) Open at 9 a.m. on New Year's Eve
|/
* fbb72b2 (origin/main, origin/HEAD) Merge branch 'main' of
https://github.com/generic-grocery-dev/generic-grocery
|\
Your hashes differ, but the shape should look the same. Both lines of history start from the merge commit that’s on GitHub, and each one changed the line for New Year’s Eve in its own way. Both changes are right, and the store wants to open at 9 a.m. and close at 4 p.m. Git can’t know that, though, as you’re about to see.