Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
FISH_GIT_PROMPT(1)		  fish-shell		    FISH_GIT_PROMPT(1)

       fish_git_prompt - output	git information	for use	in a prompt

	  function fish_prompt
	       echo -n (pwd)(fish_git_prompt) '$ '

       The fish_git_prompt function displays information about the current git
       repository, if any.

       Git must	be installed.

       There are numerous customization	options, which can be controlled  with
       git  options  or	 fish  variables.  git	options, where available, take
       precedence over the fish	variable with the same function.  git  options
       can  be set on a	per-repository or global basis.	git options can	be set
       with the	git config command, while fish variables can be	set  as	 usual
       with the	set command.

       o $__fish_git_prompt_show_informative_status    or   the	  git	option
	 bash.showInformativeStatus can	be set	to  enable  the	 "informative"
	 display,  which  will show a large amount of information - the	number
	 of untracked files, dirty files, unpushed/unpulled commits, and more.
	 In  large  repositories,  this	 can take a lot	of time, so it you may
	 wish to disable it in these repositories  with	  git  config  --local
	 bash.showInformativeStatus false.

       o $__fish_git_prompt_showdirtystate  or the git option bash.showDirtyS-
	 tate can be set to show if the	repository is "dirty", i.e. has	uncom-
	 mitted	changes.

       o $__fish_git_prompt_showuntrackedfiles	or the git option bash.showUn-
	 trackedFiles can be set to show if the	repository has untracked files
	 (that aren't ignored).

       o $__fish_git_prompt_showupstream can be	set to a list of values	to de-
	 termine how changes between HEAD and upstream are shown:

	    auto   summarize the difference between HEAD and its upstream

		   show	number of commits ahead/behind (+/-) upstream

	    name   if verbose, then also show the upstream abbrev name

		   similar to verbose, but shows nothing when equal - this  is
		   the default if informative status is	enabled.

	    git	   always compare HEAD to @{upstream}

	    svn	   always compare HEAD to your SVN upstream

	    none   disables (useful with informative status)

       o $__fish_git_prompt_showstashstate  can	be set to display the state of
	 the stash.

       o $__fish_git_prompt_shorten_branch_len can be set  to  the  number  of
	 characters that the branch name will be shortened to.

       o $__fish_git_prompt_describe_style  can	be set to one of the following
	 styles	to describe the	current	HEAD:

		   relative to newer annotated tag, such as (v1.6.3.2~35)

	    branch relative to newer tag or branch, such as (master~4)

		   relative    to    older    annotated	   tag,	   such	    as

		   exactly matching tag

       o $__fish_git_prompt_showcolorhints  can	 be set	to enable coloring for
	 the branch name and status symbols.

       A number	of variables set characters and	color used as indicators. Many
       of  these  have a different default if used with	informative status en-
       abled, or $__fish_git_prompt_use_informative_chars set. The  usual  de-
       fault  is  given	 first,	then the informative default (if it is differ-
       ent).  If  no  default  for  the	 colors	 is  given,  they  default  to

       o $__fish_git_prompt_char_stateseparator	(' ', |)

       o $__fish_git_prompt_color ('')

       o $__fish_git_prompt_color_prefix

       o $__fish_git_prompt_color_suffix

       o $__fish_git_prompt_color_bare

       o $__fish_git_prompt_color_merging

       Some  variables are only	used in	some modes, like when informative sta-
       tus is enabled:

       o $__fish_git_prompt_char_cleanstate (a)

       o $__fish_git_prompt_color_cleanstate

       Variables used with showdirtystate:

       o $__fish_git_prompt_char_dirtystate (*,	a)

       o $__fish_git_prompt_char_invalidstate (#, a)

       o $__fish_git_prompt_char_stagedstate (+, a)

       o $__fish_git_prompt_color_dirtystate (red with showcolorhints, same as
	 color_flags otherwise)

       o $__fish_git_prompt_color_invalidstate

       o $__fish_git_prompt_color_stagedstate	(green	 with  showcolorhints,
	 color_flags otherwise)

       Variables used with showstashstate:

       o $__fish_git_prompt_char_stashstate ($,	a)

       o $__fish_git_prompt_color_stashstate (same as color_flags)

       Variables used with showuntrackedfiles:

       o $__fish_git_prompt_char_untrackedfiles	(%, a|)

       o $__fish_git_prompt_color_untrackedfiles (same as color_flags)

       Variables used with showupstream	(also implied by informative status):

       o $__fish_git_prompt_char_upstream_ahead	(>, a)

       o $__fish_git_prompt_char_upstream_behind (<, a)

       o $__fish_git_prompt_char_upstream_diverged (<>)

       o $__fish_git_prompt_char_upstream_equal	(=)

       o $__fish_git_prompt_char_upstream_prefix ('')

       o $__fish_git_prompt_color_upstream

       Colors used with	showcolorhints:

       o $__fish_git_prompt_color_branch (green)

       o $__fish_git_prompt_color_branch_detached (red)

       o $__fish_git_prompt_color_flags	(--bold	blue)

       Note that all colors can	also have a corresponding _done	color. For ex-
       ample,	the   contents	of  $__fish_git_prompt_color_upstream_done  is
       printed right _after_ the upstream.

       See also	fish_vcs_prompt, which will call all supported version control
       prompt functions, including git,	Mercurial and Subversion.

       A simple	prompt that displays git info:

	  function fish_prompt
	      #	...
	      set -g __fish_git_prompt_showupstream auto
	      printf '%s %s$' $PWD (fish_git_prompt)

       2019, fish-shell	developers

3.1				 Aug 11, 2020		    FISH_GIT_PROMPT(1)


Want to link to this manual page? Use this URL:

home | help