---
id: git
title: Git
sidebar_label: Git
---

## What

Display 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][poshgit]
:::

## Sample Configuration

```json
{
  "type": "git",
  "style": "powerline",
  "powerline_symbol": "\uE0B0",
  "foreground": "#193549",
  "background": "#ffeb3b",
  "properties": {
    "display_status": true,
    "display_stash_count": true,
    "display_upstream_icon": true
  }
}
```

## Properties

### Standard

- branch_icon: `string` - the icon to use in front of the git branch name - defaults to `\uE0A0 `
- display_branch_status: `boolean` - display the branch status or not - defaults to `true`
- 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 where `0` implies full length - defaults to `0`

### Status

- display_status: `boolean` - display the local changes or not - defaults to `false`
- display_status_detail: `boolean` - display the local changes in detail or not - defaults to `true`
- display_stash_count: `boolean` show stash count or not - defaults to `false`
- display_worktree_count: `boolean` show worktree count or not - defaults to `false`
- status_separator_icon: `string` icon/text to display between staging and working area changes - defaults to ` |`
- local_working_icon: `string` - the icon to display in front of the working area changes - defaults to `\uF044`
- local_staged_icon: `string` - the icon to display in front of the staged area changes - defaults to `\uF046`
- stash_count_icon: `string` icon/text to display before the stash context - defaults to `\uF692`
- worktree_count_icon: `string` icon/text to display before the worktree context - defaults to `\uF1BB`

### HEAD context

- 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 context

- display_upstream_icon: `boolean` - display upstream icon or not - defaults to `false`
- 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 `

### Colors

- working_color: `string` [color][colors] - foreground color for the working area status - defaults to segment foreground
- staging_color: `string` [color][colors] - foreground color for the staging area status - defaults to segment foreground
- status_colors_enabled: `boolean` - color the segment based on the repository status - defaults to `false`
- color_background: `boolean` - color background or foreground - defaults to `true`
- local_changes_color: `string` [color][colors] - segment color when there are local changes - defaults to segment
foreground/background (see `color_background`)
- ahead_and_behind_color: `string` [color][colors] - segment color when the branch is ahead and behind -
defaults to segment foreground/background (see `color_background`)
- behind_color: `string` [color][colors] - segment color when the branch is behind - defaults to segment
foreground/background (see `color_background`)
- ahead_color: `string` [color][colors] - segment color when the branch is ahead - defaults to segment
foreground/background (see `color_background`)

[colors]: /docs/configure#colors
[poshgit]: /docs/poshgit
