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.
Branch naming settings
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 several options to configure:
A custom prefix (for example, initials).
Whether or not the date is prepended to the branch.
Whether to allow certain characters like slashes and uppercase letters
The character to replace unsupported symbols (for example, whitespace and anything other than alphanumeric characters, periods, dashes, underscores, and slashes.)
Submit settings
Set PR metadata in CLI
Graphite lets you prepare your PR for review in the web UI by default. This allows you to preview markdown, pull options like reviewers and labels from downstack PR's, and update all PR's in a stack at once.
Enable this setting to instead default to writing PR description in the CLI.
PR description
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.
Default utilities
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.
Rebase behavior
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.
Tips
Toggle on and off inline tips in the Graphite CLI.
Yubikey
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.
Repository-level configuration
Note
Repository-level configuration is stored in the .git
folder of your repository.
Git remote name
Graphite defaults to pushing to and pulling from origin
. If you have configured a different name for your remote, you can set it manually.
GitHub repository information
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.