MicrolearnENPTES

Pick a side: --ours and --theirs

Lesson 14 of 24 · Git.Micro

Sometimes one side of a conflict is simply right. Instead of editing by hand, take that whole version of the file.

During a merge, ours is the branch you're on and theirs is the branch coming in.

git checkout --theirs file (or git restore --theirs file) takes their version; --ours keeps yours.

Then git add and git commit as usual. Changed your mind? git merge --abort goes back to before the merge.

Check yourself

You're on main and run git merge feature. In a conflict, what is "theirs"?

Merge redesign into main. For the conflict in config.txt, keep the version from redesign (theirs).

Do it in the browser: a real Git tool, a short mission and instant feedback. No install.

Start this lesson — free
← Resolving a merge conflictStash: put work aside →

All lessons · Git.Micro