How to use
- Paste text that contains Git or SVN conflict markers (<<<<<<<, =======, >>>>>>>); the tool detects which one it is. Or open Merge three versions and enter your version, the common ancestor and the other version. Use Load example to try either.
- For each conflict, press Accept Current, Accept Incoming or Accept Both. The buttons at the top apply a choice to every conflict at once.
- Copy the result and save it over your file. Conflicts you have not resolved stay in the result with their markers, so nothing is lost.
Examples
<<<<<<< HEAD return 3; ======= return 5; >>>>>>> feature
→ Accept Current gives: return 3; Accept Incoming gives: return 5; Accept Both gives both lines, Current first.
<<<<<<< .mine timeout = 30 ======= timeout = 60 >>>>>>> .r1234
→ Detected as Subversion. Accept Mine gives: timeout = 30 Accept Repository gives: timeout = 60After an svn update, the sides are labelled .mine (your working copy) and .r followed by the revision number from the repository.
Base: color is blue, size is 10. Current: size is 12. Incoming: color is green, size is 14.
→ 1 conflict (size: 12 against 14). The color change merges automatically.Only the line that both sides changed differently is a conflict.
A conflict block without its closing >>>>>>> line
→ Error: the conflict that starts on that line has no closing marker.
How it works
Resolving markers. The tool reads the text line by line. A line of exactly seven < characters starts a conflict, a line of seven = characters separates the two sides, and a line of seven > characters ends it. An optional line of seven | characters starts the base section. Git and Subversion write the same markers; the labels after them show which one produced the file. Everything outside these blocks is kept as it is. The result is rebuilt by replacing each conflict with the lines of the side you chose; conflicts you leave open are written back unchanged, including their original line endings.
Merging three versions. The three texts are split into lines and compared with a standard three-way merge algorithm. Lines changed on only one side are taken from that side. When both sides make the same change, it is applied once without a conflict. When both sides change the same lines in different ways, the region becomes a conflict, shown with the Current, Base and Incoming versions (or Mine, Original and Repository, if you choose the SVN side names).
If a block is incomplete, for example a conflict that is never closed or one that starts inside another, the tool shows an error that names the line instead of guessing.
Sources
- Git documentation: git merge, how conflicts are presented
- Version Control with Subversion: resolving conflicts
- Subversion design notes: conflict file names (.mine, .rX, .working, .merge-left, .merge-right)
- node-diff3, the open-source library used for three-way merging
Frequently asked questions
- What do the conflict markers mean?
- Between <<<<<<< and ======= are the lines from your current branch (often labelled HEAD). Between ======= and >>>>>>> are the lines from the branch being merged in, the incoming side. Git writes these markers when both sides changed the same part of a file and it cannot choose.
- How are SVN conflicts different from Git conflicts?
- The markers look the same; only the labels differ. After svn update they are .mine and .r followed by a revision number. After svn merge they are .working, .merge-left.r followed by a revision number and .merge-right.r followed by a revision number. The tool recognises these labels and calls the sides Mine and Repository, or Working copy and Merge source, instead of Current and Incoming.
- How do I use this with an SVN conflict?
- Open the conflicted file, paste its contents here, resolve each conflict, and save the result over the file. Then tell Subversion the conflict is solved with svn resolve --accept working followed by the file name, and commit as usual.
- What is the base section with |||||||?
- Some setups (the Git diff3 conflict style, and Subversion merges) also include the common ancestor between ||||||| and =======. When it is present, the tool shows it as a third column and lets you pick Use Base.
- What is the difference between the two modes?
- Resolve conflict markers works on a file Git has already marked. Merge three versions does the merge itself: it compares your version and the other version against the common ancestor, merges everything that does not clash, and shows only the clashes as conflicts.
- Does the tool decide which side is correct?
- No. It only applies the side you pick. Accept Both just puts the two sides one after the other, so check that the result still makes sense, and compile or test your code afterwards.
- Is my code uploaded?
- No. Parsing and merging run in your browser and the text is never sent to a server.