Skip to content

CLI shorthands

git-spice comes built-in with short versions of most commands to make them easier to remember and type. To determine the shorthand for a command, run the command with the --help flag.

$ gs branch create --helpUsage: gs branch (b) create (c) [<name>] [flags]# ...

The shorthand for a command is the bits in parentheses joined together. For example, the shorthand for gs branch create above is gs bc. Another example:

$ gs branch checkout --helpUsage: gs branch (b) checkout (co) [<branch>] [flags]# ...

The shorthand for gs branch checkout is gs bco.

When to use built-in shorthands?

We encourage adopting the built-in shorthands after you are comfortable with the corresponding full command names. The shorthands are designed to be easy to remember and type, but they may not be obvious if you don't know the full command name.

The shorthands act as a mnemonic aid: invoke the full command name in your head while typing the shorthand.

Built-in shorthands

Below is a complete list of shorthands built into git-spice.

Shorthand Long form
gs bc gs branch create
gs bco gs branch checkout
gs bd gs branch delete
gs be gs branch edit
gs bfo gs branch fold
gs bon gs branch onto
gs br gs branch restack
gs brn gs branch rename
gs bs gs branch submit
gs bsp gs branch split
gs btr gs branch track
gs buntr gs branch untrack
gs ca gs commit amend
gs cc gs commit create
gs csp gs commit split
gs dse gs downstack edit
gs dss gs downstack submit
gs ll gs log long
gs ls gs log short
gs rba gs rebase abort
gs rbc gs rebase continue
gs ri gs repo init
gs rs gs repo sync
gs se gs stack edit
gs sr gs stack restack
gs ss gs stack submit
gs uso gs upstack onto
gs usr gs upstack restack
gs uss gs upstack submit

Custom shorthands

v0.4.0

git-spice's configuration system supports defining custom shorthands for git-spice commands by setting configuration keys under the spice.shorthand namespace.

spice.shorthand.<short> = <command> <arg> ...

Shorthands begin with the name of a git-spice command, followed by zero or more arguments to the command.

For example:

# Define a shorthand for the current user$ git config --global spice.shorthand.ch "branch checkout"# Define a shorthand in just the current repository$ git config --local spice.shorthand.can "commit amend --no-edit"

Overriding built-in shorthands

User-defined shorthands take precedence over built-in shorthands. You may use this to override a built-in shorthand with a custom one. For example:

# Replace the "branch restack" shorthand$ git config --global spice.shorthand.br "branch rename"

If the result of a user-defined shorthand refers to a built-in shorthand, both will be expanded.

$ git config --global spice.shorthand.bb bco# bb will expand to bco, which will expand to "branch checkout"