mariuszs blog

The official mariuszs blog.

Informative Git Prompt with Fish


This prompt is a port of the Informative git prompt for bash which is based on Informative git prompt for zsh. Original idea is from blog post A zsh prompt for Git users.

The prompt may look like the following:

  • (master↑3|✚1): on branch master, ahead of remote by 3 commits, 1 file changed but not staged

  • (status|●2): on branch status, 2 files staged

  • (master|✚7…): on branch master, 7 files changed, some files untracked

  • (master|✖2✚3): on branch master, 2 conflicts, 3 files changed

  • (experimental↓2↑3|✔): on branch experimental; your branch has diverged by 3 commits, remote by 2 commits; the repository is otherwise clean

  • (:70c2952|✔): not on any branch; parent commit has hash 70c2952; the repository is otherwise clean

Prompt Structure

By default, the general appearance of the prompt is:

(<branch> <branch tracking>|<local status>)

The symbols are as follows:

  • Local Status Symbols

    : repository clean

    ●n: there are n staged files

    ✖n: there are n unmerged files

    ✚n: there are n changed but unstaged files

    …n: there are n untracked files

  • Branch Tracking Symbols

    ↑n: ahead of remote by n commits

    ↓n: behind remote by n commits

    ↓m↑n: branches diverged, other by m commits, yours by n commits

  • Branch Symbol:

    When the branch name starts with a colon :, it means it’s actually a hash, not a branch (although it should be pretty clear, unless you name your branches like hashes :-)


To configure informative git prompt in Fish shell run fish_config from command line. In browser window select prompt and mark Informative Git Prompt. To enable selected prompt click use prompt.

fish_config prompt selection screen

Informative Git prompt configuration:

set -g __fish_git_prompt_show_informative_status 1
set -g __fish_git_prompt_hide_untrackedfiles 1

set -g __fish_git_prompt_color_branch magenta bold
set -g __fish_git_prompt_showupstream "informative"
set -g __fish_git_prompt_char_upstream_ahead "↑"
set -g __fish_git_prompt_char_upstream_behind "↓"
set -g __fish_git_prompt_char_upstream_prefix ""

set -g __fish_git_prompt_char_stagedstate "●"
set -g __fish_git_prompt_char_dirtystate "✚"
set -g __fish_git_prompt_char_untrackedfiles "…"
set -g __fish_git_prompt_char_conflictedstate "✖"
set -g __fish_git_prompt_char_cleanstate "✔"

set -g __fish_git_prompt_color_dirtystate blue
set -g __fish_git_prompt_color_stagedstate yellow
set -g __fish_git_prompt_color_invalidstate red
set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
set -g __fish_git_prompt_color_cleanstate green bold

You can customize this configuration by editing ~/.config/fish/ and overwriting variables.