posh git not showing status flags

1.3k Views Asked by At

I got a problem with posh git not showing the status flags. This is what it looks like: enter image description here

As you can see there are changes and my branch is behind the origin, but still the prompt only displays the current branch in Cyan. While it is ahead (Green and should have ~- for modified and deleted files.

i did remove the whole stuff again, and reinstalled it using PsGet Install-Module. Still no luck.

2

There are 2 best solutions below

0
On BEST ANSWER

I found out why this did not work. The Method Get-GitStatus of GitUtil.ps1 (https://github.com/dahlbyk/posh-git/blob/master/GitUtils.ps1) contains a call to git status that looks like this:

$status = git -c color.status=false status --short --branch 2>$null

but to make git work in PowerShell - ISE i created a git.cmd with the following code:

@echo off
git.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 2>&1

and added a alias git to target the cmd. As i described here (Powershell displays some git command results as error in console even though operation was successful)

Which destroys the git status parsing of the posh~git GitUtils.ps1. I changed the GitUtils.ps1 to

$status = git status --short --branch
0
On

I recently had the same symptoms. They were resolved by upgrading both the posh-git, and oh-my-posh modules, and then restarting my terminal.

See:

PowerShellGet\Update-Module posh-git

Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1'))