Erik Elizalde

Technical Director

0

No products in the cart.

Erik Elizalde
Erik Elizalde
Erik Elizalde
Erik Elizalde
Erik Elizalde

Technical Director

Blog Post

Tip: Resolving Conflicts with git checkout –theirs

June 18, 2025 tips

When working in a team, it’s common for two people to edit the same file and cause a conflict during a merge.

The usual process is to open the file, look for the <<<<<<< markers, and manually decide which changes to keep. But Git gives us quicker tools for certain scenarios.

If you want to resolve a conflict by accepting the version from the branch you’re merging into your current branch, you can use:

git checkout --theirs path/to/file

This replaces the conflicted file with the version from the other branch.

Example:

You’re on main and you run: git merge feature-branch

If there’s a conflict in script.py, and you decide to keep the changes from feature-branch, just run:

git checkout --theirs script.py git add script.py git commit

When to use this:

  • You know the incoming version is the correct one.
  • The conflict is simple and doesn’t need manual review.
  • You want to automate merge strategies in a script or CI pipeline.
tip: Use git checkout --ours if you prefer to keep your version instead.