oh-my-zshwindows-terminalposh-git

Windows Terminal + oh-my-posh not showing git status


I have installed oh-my-posh and posh-git in my Windows Terminal, however it does not track any of the git changes as you can see in the picture. Regardless of any changes I have made it just shows like this with no status:

enter image description here

I have also tried without posh-git as I thought oh-my-posh had this functionality by default, but still the same result.

Here's my oh-my-posh theme:

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "blocks": [
    {
      "alignment": "left",
      "segments": [
        {
          "background": "#91ddff",
          "foreground": "#100e23",
          "powerline_symbol": "",
          "properties": {
            "folder_icon": "",
            "folder_separator_icon": "  ",
            "home_icon": "",
            "style": "agnoster"
          },
          "style": "powerline",
          "type": "path"
        },
        {
          "background": "#95ffa4",
          "foreground": "#193549",
          "powerline_symbol": "",
          "style": "powerline",
          "type": "git"
        },
        {
          "background": "#906cff",
          "foreground": "#100e23",
          "powerline_symbol": "",
          "properties": {
            "prefix": "  "
          },
          "style": "powerline",
          "type": "python"
        },
        {
          "background": "#ff8080",
          "foreground": "#ffffff",
          "powerline_symbol": "",
          "style": "powerline",
          "type": "exit"
        }
      ],
      "type": "prompt"
    }
  ],
  "final_space": true
}


Solution

  • Found the answer here: https://ohmyposh.dev/docs/git/. Apparently the git status is disabled by default so you need to add a properties section to the git configuration:

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

    It's also possible to use posh-git:

    {
      "type": "poshgit",
      "style": "powerline",
      "powerline_symbol": "\uE0B0",
      "foreground": "#ffffff",
      "background": "#0077c2"
    }