Skip to content
  • Florian 
  • 2 min read

How to use Kaleidoscope for a merge conflict

This is an actual question we received in support, so maybe others have wondered about that, too.

Can I use Kaleidoscope for a merge conflict?

Can I use Kaleidoscope for a merge conflict?

From the command line, if I run

git difftool

it usually loads the differences into Kaleidoscope and starts the app.

But if I have a merge conflict, and enter

git difftool

I only get textual output, Kaleidoscope does not open:

diff --cc folder1/folder2/ContentView.swift
index 9173b58,6f67c3d..0000000
--- a/folder1/folder2/ContentView.swift
+++ b/folder1/folder2/ContentView.swift
@@@ -8,8 -8,10 +8,15 @@@ struct ContentView: View
          NavigationView {
              VStack {
                  Picker("Select an option", selection: $selectedIndex) {
++<<<<<<< HEAD
 +                    Text("Option 1").tag(1)
 +                    Text("Other Option").tag(2)
++=======
+                     Text("Item 0").tag(0)
+                     Text("Item 2").tag(1)
+                     Text("Item 3").tag(3)
+                     Text("Item 4").tag(4)
++>>>>>>> develop
                  }
                  .pickerStyle(SegmentedPickerStyle())

...
 

Why?

Why?

That’s how git works. There’s an extra command for that case. Most Git GUI apps hide that complexity from the user, but on the command line you need to know the difference between difftool and mergetool. If you have a conflict in your working copy, you need to use git mergetool.

As you were probably using the command line before to create that conflict, for example by using git merge <branch>, you were made aware of that fact by git:

git merge develop

The output was something like this:

Auto-merging folder1/folder2/ContentView.swift
CONFLICT (content): Merge conflict in folder1/folder2/ContentView.swift
Automatic merge failed; fix conflicts and then commit the result.

Now you need to enter

git mergetool

Kaleidoscope will open a new merge for the conflicting file:

Kaleidoscope assisting in the merge of a SwiftUI view.

You can now resolve the conflicts and save the file using Kaleidoscope.

Note that Kaleidoscope needs to be set up as default difftool and mergetool for these commands to work. Select Kaleidoscope > Integration… from the menu and then select Git to set it up and learn more.