'How do I remove the cruft at the start of my posh-git window title?

I'm using posh-git for my powershell window, and the prompt is perfect:

S:\Repos\DevTools [master ≡ +1 ~2 -0 !]>

But the title of the window has extra cruft at the start:

posh~git ~ DevTools [master]

Does anyone know how I can get rid of the extra posh~git ~? It doesn't seem necessary or useful, though maybe I simply don't understand what it is trying to tell me.



Solution 1:[1]

Well, would you look at that! It got fixed just today! https://github.com/dahlbyk/posh-git/pull/567

Thanks guys!

Solution 2:[2]

To elaborate on the accepted answer, there is a customisation option available which will let you set a custom prefix, or alternatively no prefix.

In your Powershell profile (find it by running $Profile, in my case it is this file here: C:\Users\myuser\Documents\PowerShell\Microsoft.PowerShell_profile.ps1) add the following:

Import-Module posh-git # should already exist if you have posh-git set up
$GitPromptSettings.EnableWindowTitle = $TRUE # or set it to a string if you want a different custom prefix
$GitPromptSettings.AdminTitlePrefixText = "" # optional, remove the prefix when running as admin

Restart your session and you should be up and running.

Solution 3:[3]

As of posh-git 1.0.0, the posh~git ~ prefix is no longer present by default.

Note also that the EnableWindowTitle property no longer exists in the global $GitPromptSettings object; this property is now called WindowTitle and is a function that you can override to customise the prompt, e.g. in your $profile.

For example, the below changes the window title text to use Unicode character 1f6e1 (the shield symbol) instead of the default text Admin: when running elevated:

$global:GitPromptSettings.WindowTitle = {
    param($GitStatus, [bool]$IsAdmin)
        "$(if ($IsAdmin) {"`u{1f6e1} "})$(if ($GitStatus) {"$($GitStatus.RepoName) [$($GitStatus.Branch)]"} else {Get-PromptPath}) - PowerShell $($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor) $(if ([IntPtr]::Size -eq 4) {'32-bit '})($PID)"
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Geeven Singh
Solution 2 elwyn
Solution 3