Home / Companies / Code Input / Blog / Post Details
Content Deep Dive

Git Merge Conflicts: Understanding Ours, Theirs, and Base

Blog post from Code Input

Post Details
Company
Date Published
Author
Abid Omar
Word Count
1,179
Company Posts That Month
1
Language
English
Hacker News Points
-
Post removed?
No
Summary

Merge conflicts in Git arise when two branches alter the same part of a file in different ways, preventing Git from automatically deciding which change to keep. Understanding merge conflicts involves grasping the concept of three versions: ours, theirs, and base. The base represents the common ancestor commit before branches diverged, ours is the version on the branch receiving the merge, and theirs is the version from the branch being merged in. Conflicts are less frequent when modifications occur in different parts of a file, allowing Git to merge changes seamlessly. To resolve conflicts, users can either accept one side entirely using Git shortcuts or manually edit files, often aided by visual tools that display all three versions—ours, theirs, and base—side by side, facilitating a more intuitive resolution process. The terms ours and theirs originate from the Unix utility diff3, and while they might seem counterintuitive, they denote the branches accepting and providing changes, respectively.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.