Git
#
WhatDisplay git information when in a git repository. Also works for subfolders. For maximum compatibility,
make sure your git
executable is up-to-date (when branch or status information is incorrect for example).
Local changes can also be displayed which uses the following syntax for both the working and staging area:
+
added~
modified-
deleted?
untracked
tip
PowerShell offers support for the posh-git
module for autocompletion, but it is disabled by default.
To enable this, set $env:POSH_GIT_ENABLED = $true
in your $PROFILE
.
warning
Starting from version 3.152.0, display_status
is disabled by default.
It improves performance but reduces the quantity of information. Don't forget to enable it in your theme if needed.
An alternative is to use the Posh-Git segment
#
Sample Configuration#
Properties#
Fetching informationAs doing multiple git calls can slow down the prompt experience, we do not fetch information by default.
You can set the following properties to true
to enable fetching additional information (and populate the template).
- fetch_status:
boolean
- fetch the local changes - defaults tofalse
- fetch_stash_count:
boolean
fetch stash count - defaults tofalse
- fetch_worktree_count:
boolean
fetch worktree count - defaults tofalse
- fetch_upstream_icon:
boolean
- fetch upstream icon - defaults tofalse
- untracked_modes:
map[string]string
- map of repo's where to override the default untracked mode (no
|normal
|all
). For example"untracked_modes": { "/Users/me/repos/repo1": "no" }
- defaults tonormal
for all repo's
#
Icons#
Branch- branch_icon:
string
- the icon to use in front of the git branch name - defaults to\uE0A0
- branch_identical_icon:
string
- the icon to display when remote and local are identical - defaults to\u2261
- branch_ahead_icon:
string
- the icon to display when the local branch is ahead of its remote - defaults to\u2191
- branch_behind_icon:
string
- the icon to display when the local branch is behind its remote - defaults to\u2193
- branch_gone_icon:
string
- the icon to display when there's no remote branch - defaults to\u2262
- branch_max_length:
int
- the max length for the displayed branch name where0
implies full length - defaults to0
- truncate_symbol:
string
- the icon to display when a branch name is truncated - defaults to empty
#
HEAD- commit_icon:
string
- icon/text to display before the commit context (detached HEAD) - defaults to\uF417
- tag_icon:
string
- icon/text to display before the tag context - defaults to\uF412
- rebase_icon:
string
- icon/text to display before the context when in a rebase - defaults to\uE728
- cherry_pick_icon:
string
- icon/text to display before the context when doing a cherry-pick - defaults to\uE29B
- revert_icon:
string
- icon/text to display before the context when doing a revert - defaults to\uF0E2
- merge_icon:
string
icon/text to display before the merge context - defaults to\uE727
- no_commits_icon:
string
icon/text to display when there are no commits in the repo - defaults to\uF594
#
Upstream- github_icon:
string
- icon/text to display when the upstream is Github - defaults to\uF408
- gitlab_icon:
string
- icon/text to display when the upstream is Gitlab - defaults to\uF296
- bitbucket_icon:
string
- icon/text to display when the upstream is Bitbucket - defaults to\uF171
- azure_devops_icon:
string
- icon/text to display when the upstream is Azure DevOps - defaults to\uFD03
- git_icon:
string
- icon/text to display when the upstream is not known/mapped - defaults to\uE5FB
info)#
Template (default template
#
Properties.Working
:GitStatus
- changes in the working tree (see below).Staging
:GitStatus
- staged changes in the work tree (see below).HEAD
:string
- the current HEAD context (branch/rebase/merge/...).Behind
:int
- commits behind of upstream.Ahead
:int
- commits ahead of upstream.BranchStatus
:string
- the current branch context (ahead/behind string representation).Upstream
:string
- the upstream name (remote).UpstreamGone
:boolean
- whether the upstream is gone (no remote).UpstreamIcon
:string
- the upstream icon (based on the icons above).UpstreamURL
:string
- the upstream URL for use in hyperlinks in templates:{{ url .UpstreamIcon .UpstreamURL }}
.StashCount
:int
- the stash count.WorktreeCount
:int
- the worktree count.IsWorkTree
:boolean
- if in a worktree repo or not
#
GitStatus.Unmerged
:int
- number of unmerged changes.Deleted
:int
- number of deleted changes.Added
:int
- number of added changes.Modified
:int
- number of modified changes.Changed
:boolean
- if the status contains changes or not.String
:string
- a string representation of the changes above