1

In SVN if there is a conflict, the different versions of the conflicted file are saved to the workspace with postfixes. Can I have this in Git as well? I should now hold some training about TortoiseGit, and if a binary conflict occurs, I don't see any simple option to have the different versions of the file in the workspace. I know that I can checkout the file from a specific hash with a different name, but I want it automatically.

So what I want in my workspace automatically saved in case of a conflict:

  • myconflictedfile.doc
  • myconflictedfile.doc.base
  • myconflictedfile.doc.theirs
  • myconflictedfile.doc.mine

Is it possible?

Yue Lin Ho
  • 2,945
  • 26
  • 36
Gábor Lipták
  • 9,646
  • 2
  • 59
  • 113

1 Answers1

3

In case of a merge conflict, git already save those different version for you:
From git help merge:

Look at the originals:

  • git show :1:filename shows the common ancestor,
  • git show :2:filename shows the HEAD version, and
  • git show :3:filename shows the MERGE_HEAD version.

You can also quickly resolve a conflict merge by choosing 'mine' or 'their' version.

git checkout --ours   yourfile # Your version
git checkout --theirs yourfile # Repository version
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks VonC. Do you have any idea, how to get the files with TortoiseGit during a rebase for example? I cannot find any "non command line" solution for this. – Gábor Lipták Dec 16 '13 at 09:04
  • 1
    @GáborLipták no, I didn't see a way to do this through the GUI. You can setup a mergetool, though, which will show you in case of conflict the 4 files (merged, base, outs, theirs), as at the end of http://stackoverflow.com/a/3052118/6309, with setup mentioned in http://stackoverflow.com/a/586002/6309. – VonC Dec 16 '13 at 18:19