oh-my-posh: Git status not displayed

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

Hello.

I’ve just installed oh-my-posh 3.158.3 and I feel most of its themes don’t display the Git status properly. (I tried searching this repo’s issues, and the only one that came up was #731, which is not relevant enough. So, I’m opening this new issue.)

I initialize my environment with these commands:

Import-Module -Name "posh-git"
Import-Module -Name "oh-my-posh" -MinimumVersion 3.0
Set-Location F:\Projects\AdminScripts

My prompt looks like this: It says I have one pending change.

So far so good. I continue by setting the slimfat theme.

Set-PoshPrompt -Theme Slimfat

My prompt looks like this: It says I have one pending change.

Again, so far so good. Here is where the problem starts: I set the Agnoster theme.

Set-PoshPrompt -Theme Agnoster

Actual behavior: My prompt looks like this: Agnoster, with Posh-Git It says my local repo is in sync with my remote repo, which is not correct.

Expected behavior: My prompt must indicate that I have pending changes. Here is how the Agnoster theme from oh-my-posh 2 showed it: Agnoster from version 2, with Posh-Git

Environment

  • Oh my Posh version: 3.158.3
  • Theme: (Several, see explanation)
  • Operating System: Windows 10 version 21H1 x64
  • Shell: Windows PowerShell 7.1
  • Terminal: Windows Terminal 1.8

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks @JanDeDobbeleer. Figured it out yesterday based in another of your replies but just wanted to give a heads up about the docs site being down. Take care + hope you’re having a good week so far.

@muhammad-usman-anwar just like the sample, set "display_status": true in your git segment.

@JanDeDobbeleer, you’re absolutely right! I updated git to 2.31.1 and now it’s working. Please disregard my previous request—now that it’s showing the branch rather than the SHA, the git segment is useful again 😄

Could we update the docs for the git segment to include this requirement?

@tom-mckinney I get your point but we’ve seen many people having issues with large repos and thus git being slow due to status. What’s important to understand, and a key difference when coming from V2, is that the current themes serve more as examples rather than full blown configs to serve every use-case. It’s pretty straightforward to create your own enabling every possible feature you’d like and tailoring the experience (which is guaranteed to be compatible). I could’ve made that change introduce the 4.x version, but we would in all honesty be having the same conversation.

The SHA is another issue to be honest, that would imply git branch --show-current doesn’t return a value. Can you validate and make sure you’re on the latest version of git?