logoalt Hacker News

IgorPartolayesterday at 6:57 PM5 repliesview on HN

Let’s see if I get this wrong after 25 years of git:

ours means what is in my local codebase.

theirs means what is being merged into my local codebase.

I find it best to avoid merge conflicts than to try to resolve them. Strategies that keep branches short lived and frequently merging main into them helps a lot.


Replies

marcellus23yesterday at 7:11 PM

That's kind of the simplest case, though, where "theirs" and "ours" makes obvious sense.

What if I'm rebasing a branch onto another? Is "ours" the branch being rebased, or the other one? Or if I'm applying a stash?

show 2 replies
clktmryesterday at 7:22 PM

The thing is, you'll typically switch to master to merge your own branch. This makes your own branch 'theirs', which is where the confusion comes from.

show 1 reply
em-beeyesterday at 7:14 PM

a better (more confusing) example:

i have a branch and i want to merge that branch into main.

is ours the branch and main theirs? or is ours main, and the branch theirs?

show 1 reply
imiricyesterday at 11:14 PM

> Let’s see if I get this wrong after 25 years of git

You used it 5 years before Linus? Impressive!

show 1 reply
KPGv2yesterday at 10:55 PM

> ours means what is in my local codebase

Since it's always one person doing a merge, why isn't it "mine" instead of "ours"? There aren't five of us at my computer collaboratively merging in a PR. There is one person doing it.

"Ours" makes it sound like some branch everyone who's working on the repo already has access to, not the active branch on my machine.

show 1 reply