gitpractice.dev

brewly — Ch.3 · Your first conflict

Exercise 7 of 9

Before you start

Merge conflicts

If two commits change the same lines, git cannot choose. It stops and writes both versions into the file, between markers.

Between <<<<<<< and ======= is your version (current). Between ======= and >>>>>>> is theirs (incoming).

Decide what the file should say, using the buttons above the block. Then git add the file to mark it solved, and commit to finish the merge.

git status
which files are in conflict?
git add <file>
mark a file as solved
git commit
finish the merge; keep the suggested message

Getting and sharing

First bring in the server’s commit, then push once the merge is finished.

git pull --no-rebase
fetch and merge
git push
share the result
You can reopen this any time with “Lesson”.

Continue on a desktop

Typing git on a small screen is no fun. Open this page on a laptop or desktop to practise.

Back to the path