Home ▶Git Integration

# Git Integration

Kaleidoscope offers integration with the Git version control system through the git difftool and git mergetool mechanisms. To set up this integration, open the Integration Window:

Go to Main Menu > Kaleidoscope > Integration...

In the Integration Window, you can choose between two options: either set Kaleidoscope as the default diff and merge tool, or just set it up as an alternative tool for ad hoc usage.

- If you choose to make Kaleidoscope the default, you can show comparisons in Kaleidoscope by invoking `git difftool`.
- If you choose to make Kaleidoscope an alternative tool, you can show comparisons in Kaleidoscope by running `git difftool -y -t Kaleidoscope`.

Adding `-y` makes sure you don't need to press return every time ksdiff has opened a tab in Kaleidoscope.

Once you have installed the integration, you can try out how it works:

1. Change a few files in your repository.
2. Run `git difftool` or `git difftool -y -t Kaleidoscope` to see the changes in Kaleidoscope.

You can try other variations: `git difftool` accepts the same arguments as `git diff`, so you can for instance run `git difftool HEAD^` to see the differences with the previous revision, or `git difftool branch_name` to show the differences between the current checkout and the branch `branch_name`. If you'd like to learn about more options, you can take a look at the git diff manpage.

## How The Integration Works

The Git integration works by setting up a custom difftool in the global git config. If you decide to use Kaleidoscope as the default diff tool (which is the default option), then it will also set Kaleidoscope as the default tool and disable prompting when a diff has finished. If you would like to set up Git integration yourself instead of doing it through the Integration window, you can add the following to your git config:

    [difftool "Kaleidoscope"]
    	cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"

    # If you want to set up Kaleidoscope as the default diff tool,
    # then also set the following variables:
    [difftool]
    	prompt = false
    [diff]
    	tool = Kaleidoscope

Much like the diff integration, Kaleidoscope's Git integration works by setting up a custom mergetool in the global git config. If you decide to use Kaleidoscope as the default merge tool (which is the default option), then it will also set Kaleidoscope as the default tool and disable prompting when a diff has finished. If you would like to set up Git integration yourself instead of doing it through the Integration window, you can add the following to your git config:

    [mergetool "Kaleidoscope"]
    	cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" \"$REMOTE\"

    # If you want to set up Kaleidoscope as the default merge tool,
    # then also set the following variables:
    [mergetool]
    	prompt = false
    [merge]
    	tool = Kaleidoscope