Starship Prompt Builder

Git commit module

Shows the current commit hash and also the tag (if any) of the repo in your current directory

When it appears

It renders when Starship detects the matching context and its configured conditions are met.

Preview

Rendered from the starting configuration in a representative simulated environment.

starship — preview
(a1b2c3d) 

Starting configuration

[git_commit]
format = "[\\($hash$tag\\)]($style) "
style = "green bold"
Open in the builder

The configuration is compressed into the URL fragment and stays in your browser.

Key options

commit_hash_lengthnumber
The length of the displayed git commit hash.
formatstring
The format for the module.
stylestring
The style for the module.
only_detachedboolean
Only show git commit hash when in detached HEAD state
disabledboolean
Disables the git_commit module.
tag_symbolstring
Tag symbol prefixing the info shown
tag_disabledboolean
Disables showing tag info in git_commit module.
tag_max_candidatesnumber
How many commits to consider for tag display. The default only allows exact matches.

Format variables

$hash
The current git commit hash
$style
Mirrors the value of option style
$tag
The tag name if showing tag info is enabled.

Common adjustments

  • Edit format to reorder its variables or make surrounding text conditional.
  • Adjust its style options to fit the palette used by the rest of the prompt.