Configure the CLI

Graphite offers a number of configurations to customize and speed up your current workflow when using the CLI.

Set up shell completion

Graphite supports zsh, bash, and fish tab completion. You can run one of the following commands:

# for zsh
gt completion >> ~/.zshrc
# for bash
gt completion >> ~/.bashrc
# or
gt completion >> ~/.bash_profile
# for fish
gt fish >> ~/.config/fish/completions/gt.fish

Configuration options

Run gt config to open an interactive menu which lets you configure your Graphite CLI. The options are described in more detail below.

User-level configuration


Note

User configuration is stored in ~/.config/graphite, unless you have $XDG_CONFIG_HOME set.


If you don't specify a name for your branch when using gt create, then Graphite will generate one for you based on the commit message.

There are three options to configure:

  1. Whether or not the date is prepended to the branch.

  2. A custom prefix (for example, initials).

  3. The character to replace unsupported symbols (for example, whitespace and anything other than alphanumeric characters, periods, dashes, underscores, and slashes.

Graphite includes your GitHub PR template in the commit message by default.

Graphite can include the commit messages of your branch in the body of your PR automatically on submit. If you enable this, you can choose whether or not to also include your PR template.

If you only have a single commit on your branch, the first line of the message (its title) will not be included as this is already the default for the name of the PR.

By default, Graphite uses the git editor for drafting PR descriptions and other flows that require editing text. You can configure a different editor.

By default, Graphite opens PR descriptions and other flows that require editing text in the git pager. You can configure a different pager, or disable paging entirely.

Note that just like git, Graphite sets the environment variables LESS=FRX and LV=-c if they are not already set. If something else is setting your LESS env var, you can use gt user pager --set "less -FRX" to get the recommended pager settings.


Tip

You can also set the editor or pager on a per-command basis with the GT_EDITOR and GT_PAGER environment variables, respectively.


The git rebase flag --committer-date-is-author-date is useful if you don't want your Graphite restack operations to update the committer date of the commits in your branches. In order to have Graphite's internal rebases use this flag, you can enable this configuration.

Toggle on and off inline tips in the Graphite CLI.

If you use a Yubikey to protect your GitHub SSH key, you may be used to Git commands reminding you to touch it. Graphite is not able to print this output directly to the CLI due to how Git calls SSH, so you can enable this configuration to be reminded when Graphite is about to run a command that requires you to touch your Yubikey.

Repo-level configuration


Note

Repo-level configuration is stored in the .git folder of your repository.


Graphite defaults to pushing to and pulling from origin. If you have configured a different name for your remote, you can set it manually.

Once the remote URL is set, Graphite infers the GitHub repository name and owner from the remote URL, but in cases where they are not inferred correctly, you can override them.