Why is the meaning of “ours” and “theirs” reversed with git-svn

Posted by Marc Liyanage on Stack Overflow See other posts from Stack Overflow or by Marc Liyanage
Published on 2010-06-02T16:05:37Z Indexed on 2010/06/03 5:54 UTC
Read the original article Hit count: 416

Filed under:
|

I use git-svn and I noticed that when I have to fix a merge conflict after performing a git svn rebase, the meaning of the --ours and --theirs options to e.g. git checkout is reversed. That is, if there's a conflict and I want to keep the version that came from the SVN server and throw away the changes I made locally, I have to use ours, when I would expect it to be theirs.

Why is that?

Example:

mkdir test
cd test
svnadmin create svnrepo
svn co file://$PWD/svnrepo svnwc
cd svnwc
echo foo > test.txt
svn add test.txt
svn ci -m 'svn commit 1'
cd ..
git svn clone file://$PWD/svnrepo gitwc
cd svnwc
echo bar > test.txt 
svn ci -m 'svn commit 2'
cd ..
cd gitwc
echo baz > test.txt 
git commit -a -m 'git commit 1'
git svn rebase

git checkout --ours test.txt
cat test.txt 
# shows "bar" but I expect "baz"

git checkout --theirs test.txt
cat test.txt 
# shows "baz" but I expect "bar"

© Stack Overflow or respective owner

Related posts about git

Related posts about git-svn