Skip to content

Git Mergetool

github-actions[bot] edited this page Oct 18, 2026 · 2 revisions

You can use Nibtree's three pane Merge Tool from the Terminal too. After a one-time setup, git mergetool opens each conflicted file in a Nibtree window, and closes it again when you are done.

This is handy if you do most of your git work on the command line but like a visual tool for conflicts.

Set it up

Run these lines once in the Terminal. They assume Nibtree is in your Applications folder.

APP="/Applications/Nibtree.app/Contents/MacOS/nibtree"
git config --global mergetool.nibtree.cmd "\"$APP\" merge \"\$BASE\" \"\$LOCAL\" \"\$REMOTE\" \"\$MERGED\""
git config --global mergetool.nibtree.trustExitCode true
git config --global merge.tool nibtree

What each line does:

  1. APP=... stores the path to the program inside the app, just to keep the next line short.
  2. mergetool.nibtree.cmd tells git how to start Nibtree. The word merge switches the app into merge tool mode, followed by the four files git prepares: the common ancestor (BASE), your version (LOCAL), the other version (REMOTE) and the file to write the result to (MERGED).
  3. trustExitCode true lets git read from Nibtree whether you finished the file or gave up.
  4. merge.tool nibtree makes it the tool git mergetool uses by default.

Leave out --global to set it up for one repository only. If the app lives somewhere else, change the APP path.

On Windows, run the same lines in Git Bash (it comes with Git for Windows), with this APP line instead:

APP="$(cygpath -m "$LOCALAPPDATA")/Nibtree/nibtree.exe"

Use it

  1. Run a merge, rebase or pull that stops on conflicts.
  2. Run git mergetool.
  3. For each conflicted file, a Nibtree window opens.

Merge tool started by git mergetool

The merge tool in its own window, opened by git mergetool.

The window has only the merge tool. Its heading reads Merge Revisions for and the file, such as src/app.ts; the window's own title bar says Merge app.ts. The left pane is Local (yours), the right pane is Remote (theirs), and the Result is in the middle. The top right counts what is left, for example 9 changes left, 2 conflicts. Everything from the Merge Tool page works here: apply and ignore buttons, Apply non-conflicting, F7 navigation, undo and Ignore whitespace.

Turning Ignore whitespace on or off here also saves it as your default (the same switch as in Settings > Git).

When you are done with the file:

  • Apply (or Cmd+Enter, from any pane) writes the result to the file and closes the window. Nibtree tells git it succeeded, so git marks the file as resolved and moves on to the next one. If changes are still unresolved, or the result still has conflict markers (<<<<<<<), you are asked first (Save Anyway).
  • Cancel (or Esc), or closing the window, leaves the file untouched. Nibtree tells git it did not finish, so the file stays unresolved. If you changed anything, you are asked (Discard Changes) before it is thrown away. Quitting with Cmd+Q also leaves the file unresolved, but without asking.

Accept Left and Accept Right also work: they resolve the whole file with one side and close the window.

After the last file, finish the operation in the Terminal as usual, for example git merge --continue or git rebase --continue.

Good to know

  • Git keeps a backup of each conflicted file with a .orig ending. If you do not want those, run git config --global mergetool.keepBackup false.
  • Binary files (such as images) cannot be merged as text. The window says so and offers Quit; resolve those with git checkout --ours or git checkout --theirs instead.
  • If the files git passed cannot be read, the window says Could not load the files passed by git mergetool with the reason, and offers Quit.
  • The merge window does not check for updates or show What's New, and it never starts the MCP server. Its menu bar is short: Nibtree (with Settings...), Edit, Window and Help.
  • If git passes an empty or missing ancestor (for example when both sides added the same file), the merge starts from an empty result.
  • Opening the full app is separate: starting Nibtree with a folder or a workspace file instead of merge opens it normally, for example "$APP" ~/code/acme.

Related

Home

Using Nibtree

Developers

How features work

Clone this wiki locally