Search code examples
gitgit-tower

How to use Kaleidoscope 2 with Git Tower?


Kaleidoscope 2 public beta was released this week and has gained merge functionality. Yay! However, the command-line usage is somewhat vague about the usage. I want to use Kaleidoscope together with Git Tower, how can I do that?

$ ksdiff --help
usage: ksdiff - send files to Kaleidoscope
command options:                        
  [--wait, -w | --no-wait]              whether to wait for the document to be
                                        closed in Kaleidoscope before exiting

FILE options:
  [--snapshot | --no-snapshot]          whether the file is temporary. this
                                        option will override the heuristics
                                        ksdiff would otherwise use to determine
                                        this state.

commands:
  --merge                               send a merge
                                        implies --wait
    --output OUTPUT                     use OUTPUT as the destination path for
                                        this merge. creates OUTPUT if it does
                                        not exist.
    [--base BASE]                       use BASE as the base content for this
                                        merge. can improve the quality of the
                                        default selections for some merges.
    FILE FILE                           the files to merge

Support docs for external merge tools from Git Tower


Solution

  • Update as of Git Tower 1.4.14

    Git Tower (version 1.4.14 and above) now ships with Kaleidoscope 2 integration. The launcher scripts shown below should not be used anymore, as they do not work correctly with Kaleidoscope 2 final version.


    Kaleidoscope provides the correct command line usage when Integration > Git merge is chosen. The correct launcher script for Git Tower looks like this:

    ~/Library/Application Support/Tower/CompareScripts/kaleidoscope2.sh

    #!/bin/sh
    
    LOCAL="$1"
    REMOTE="$2"
    BASE="$3"
    MERGED="$4"
    
    APPLICATION_PATH=/Applications/Kaleidoscope.app
    CMD="$APPLICATION_PATH/Contents/MacOS/ksdiff"
    
    "$CMD" --merge --output "$MERGED" --base "$BASE" -- "$LOCAL" --snapshot "$REMOTE" --snapshot
    

    ~/Library/Application Support/Tower/CompareTools.plist

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <array>
        <dict>
            <key>ApplicationIdentifier</key>
            <string>com.blackpixel.kaleidoscope</string>
            <key>ApplicationName</key>
            <string>Kaleidoscope</string>
            <key>DisplayName</key>
            <string>Kaleidoscope</string>
            <key>LaunchScript</key>
            <string>kaleidoscope2.sh</string>
            <key>Identifier</key>
            <string>kaleidoscope2</string>
            <key>SupportsMergeTool</key>
            <true/>
        </dict>
    </array>
    </plist>