Skip to main content

Sublime Merge includes a command line tool, smerge, to work with repositories on the command line. This can be used to open repositories, search, and merge files.

---
title: Sublime Merge Command Line Usage
subtitle: 'Sublime Merge includes a command line tool, smerge, to work with repositories on the command line. This can be used to open repositories, search, and merge files.'
author: Jon LaBelle
date: October 2, 2026
source: https://www.sublimemerge.com/docs
notoc: false
---

## Usage

```plaintext
$ smerge --help
Sublime Merge build 2132

Usage: smerge path               Open the given repository
   or: smerge search query       Search for commits in the current repository
   or: smerge blame file [line]  Blame the given file in the current repository
   or: smerge log file           Show the file history in the current repository
   or: smerge mergetool          Opens the merge tool for the given files
         [--no-wait] [base] left right [-o merged]

  -n or --new-window:      Open a new window
  --launch-or-new-window:  Only open a new window if the application is running
  -b or --background:      Don't activate the application
  --safe-mode:             Launch using a sandboxed (clean) environment
  -h or --help:            Show help (this message) and exit
  -v or --version:         Show version and exit
```

## Setup

### Windows

Add `C:\Program Files\Sublime Merge` to your environment `%PATH%` variable.

### macOS

You'll want to add a symlink (symbolic link) to `smerge`. Assuming you've placed
Sublime Merge in the Applications folder, and that you have a `~/bin` directory
in your path, you can run:

```bash
ln -s "/Applications/Sublime Merge.app/Contents/SharedSupport/bin/smerge" ~/bin/smerge
```

### Linux

`smerge` should already be available by default. However, it won't be if you're
using a tarball, so you'll want to add a symlink to `sublime_merge` named
`smerge`:

```bash
ln -s /opt/sublime_merge/sublime_merge ~/bin/smerge
```

## Git Merge Tool Setup

The merge tool can be used to process merge conflicts within a Git repository
from the command line.

After configuring `smerge` using the instructions above, run the following from
the repository directory:

```bash
git config mergetool.smerge.cmd 'smerge mergetool "$BASE" "$LOCAL" "$REMOTE" -o "$MERGED"'
git config mergetool.smerge.trustExitCode true
git config merge.tool smerge
```

#### Git Merge Tool Usage

To invoke the merge tool, run:

```bash
git mergetool
```

> **Reference** [Sublime Merge Command Line Documentation](https://www.sublimemerge.com/docs/command_line)