How to Resolve Git Merge Conflicts Accepting Ours or Theirs
Quickly resolve merge conflicts across files by accepting all changes from your branch (--ours) or the incoming branch (--theirs).
git checkout --ours <file> OR git checkout --theirs <file>Step-by-Step Execution Guide
git checkout --ours <file-path>Replaces the conflicted file with the version from the branch you are currently on.
git checkout --theirs <file-path>Replaces the conflicted file with the incoming version from the branch being merged.
git add <file-path> && git commit -m "fix: resolve conflict using theirs"Marks the conflict as resolved and finalizes the merge.
Critical Pitfalls & Precautions
- β’During a "git rebase", the meanings of "ours" and "theirs" are swapped because rebase replays your commits onto upstream.
Accept Ours / Theirs in Merge - Frequently Asked Questions
Common questions about safe rollback, remote history implications, and troubleshooting.
Run "git checkout --theirs ." followed by "git add ." to accept incoming changes across the entire workspace.
Related Git Command Guides
Browse All Git RecipesUndo your most recent Git commit while keeping all your edited files staged or unstaged in your working directory.
Discard all unstaged and uncommitted file modifications and restore your working tree to the latest commit.
Rename your current local branch and update the upstream remote tracking branch on GitHub or GitLab.
Delete a branch from remote origin (GitHub, GitLab, Bitbucket) after a pull request has been merged.
Amend the commit message of your latest commit before or after pushing.
Remove files from the Git staging area (index) without losing any of your local changes.