I'm completely confused about what mine vs theirs means. In this specific case, I've got a feature branch where I just squashed about 80 commits via rebase -i
and am merging this back into develop
. I got a few conflicts, and I just want to use whatever code is on my feature branch. I tried "mine" but that actually seemed to do the opposite.
Could someone shed some light on this terminology?
In short: "mine" is the change you're holding in your branch, "theirs" is the target branch that everything is going into.
Two ways git merge/git pull can fail This occurs because you have committed changes that are in conflict with someone else's committed changes. Git will do its best to merge the files and will leave things for you to resolve manually in the files it lists.
Git has an internal merge system that is independent of difftool . So Git decides when a change causes a conflict on its own, not by using whatever external diff or merge tools you're using (which probably use their own conflict detection and resolution strategies).
'Mine' refers to the changes that you just made . 'Theirs' would refer to the changes made by the other team member.
ours
and theirs
is a somewhat confusing concept; exacerbated when performing a rebase:
When performing a merge, ours
refers to the branch you're merging into, and theirs
refers to the branch you are merging from. So if you are trying to resolve conflicts in the middle of a merge:
ours
to accept changes from the branch we are currently on theirs
to accept changes from the branch we are merging into.That makes sense, right?
When rebasing, ours
and theirs
are inverted. Rebases pick files into a "detached" HEAD branch. The target is that HEAD branch, and merge-from
is the original branch before rebase. That makes:
--ours
the anonymous one the rebase is constructing, and --theirs
the one being rebased; I.e., rebasing replays the current branch's commits (one at a time) on top of the branch that we intend to rebase with.
"Ours" (and "mine") refer to the current branch; "theirs" refers to the branch being merged in. It sounds like you actually wanted to use "theirs".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With