Informative git prompt

Informative Git Prompt for Fish


Project maintained by mariuszs Hosted on GitHub Pages — Theme by mattgraham

Informative GIT Prompt for Fish shell

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.

Examples

The prompt may look like the following:

screen

Prompt Structure

By default, the general appearance of the prompt is:

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

The symbols are as follows:

Install

  1. Move the file __informative_git_prompt.fish into ~/.config/fish/functions.
  2. Configure your prompt in~/.config/fish/config.fish. For this you have to define function fish_prompt. Example function is inside example_config.fish - simply copy is enough.
  3. Go in a git repository and test it!

Enjoy!

Example configuration (config.fish)

function fish_prompt --description 'Write out the prompt'

  set -l last_status $status

  set_color $fish_color_cwd
  echo -n (prompt_pwd)
  set_color normal

  __informative_git_prompt

  if not test $last_status -eq 0
    set_color $fish_color_error
  end

  echo -n ' $ '

end