Downloads of v


Last update


Package test results have failed.

This package was approved by moderator mwrock on 9/13/2015.


A set of PowerShell scripts which provide Git/PowerShell integration

Prompt for Git repositories

The prompt within Git repositories can show the current branch and the state of files (additions, modifications, deletions) within.

Tab completion

Provides tab completion for common commands when using git.
E.g. git ch<tab> --> git checkout


See profile.example.ps1 as to how you can integrate the tab completion and/or git prompt into your own profile. Prompt formatting, among other things, can be customized using $GitPromptSettings, $GitTabSettings and $TortoiseGitSettings.

Note on performance: displaying file status in the git prompt for a very large repo can be prohibitively slow. Rather than turn off file status entirely, you can disable it on a repo-by-repo basis by adding individual repository paths to $GitPromptSettings.RepositoriesInWhichToDisableFileStatus.

To install posh-git, run the following command from the command line or from PowerShell:

C:\> choco install poshgit

To upgrade posh-git, run the following command from the command line or from PowerShell:

C:\> choco upgrade poshgit


  • tools\chocolateyInstall.ps1 Show
    function Insert-Script([ref]$originalScript, $script) {
        if(!($originalScript.Value -Contains $script)) { $originalScript.Value += $script }
    try {
        $binRoot = Get-BinRoot
        $oldPromptOverride = "if(Test-Path Function:\Prompt) {Rename-Item Function:\Prompt PrePoshGitPrompt -Force}"
        $newPromptOverride = "function Prompt() {if(Test-Path Function:\PrePoshGitPrompt){++`$global:poshScope; New-Item function:\script:Write-host -value `"param([object] ```$object, ```$backgroundColor, ```$foregroundColor, [switch] ```$nonewline) `" -Force | Out-Null;`$private:p = PrePoshGitPrompt; if(--`$global:poshScope -eq 0) {Remove-Item function:\Write-Host -Force}}PoshGitPrompt}"
        $poshgitPath = join-path $binRoot 'poshgit'
        try {
          if (test-path($poshgitPath)) {
            Write-Host "Attempting to remove existing `'$poshgitPath`' prior to install."
            remove-item $poshgitPath -recurse -force
        } catch {
          Write-Host 'Could not remove poshgit folder'
        $poshGitInstall = if($env:poshGit -ne $null){ $env:poshGit } else {'https://github.com/dahlbyk/posh-git/zipball/master'}
        Install-ChocolateyZipPackage 'poshgit' $poshGitInstall $poshgitPath
        $pgitDir = Dir "$poshgitPath\*posh-git*\" | Sort-Object -Property LastWriteTime | Select -Last 1
        if(Test-Path $PROFILE) {
            $oldProfile = @(Get-Content $PROFILE)
            $newProfile = @()
            #If old profile exists replace with new one and make sure prompt preservation function is on top
            $pgitExample = "$pgitDir\profile.example.ps1"
            foreach($line in $oldProfile) {
                if($line.ToLower().Contains("$poshgitPath".ToLower())) {
                    Insert-Script ([REF]$newProfile) $oldPromptOverride
                    $line = ". '$pgitExample'"
                if($line.Trim().Length -gt 0) {  $newProfile += $line }
            # Save any previous Prompt logic
            Insert-Script ([REF]$newProfile) $oldPromptOverride
            Set-Content -path $profile -value $newProfile -Force
        $subfolder = get-childitem $poshgitPath -recurse -include 'dahlbyk-posh-git-*' | select -First 1
        write-debug "Found and using folder `'$subfolder`'"
        $installer = Join-Path $subfolder 'install.ps1'
        & $installer
        $newProfile = @(Get-Content $PROFILE)
        Insert-Script ([REF]$newProfile) "Rename-Item Function:\Prompt PoshGitPrompt -Force"
        # function that will run previous prompt logic and then the poshgit logic
        # all output from previous prompts will be swallowed
        Insert-Script ([REF]$newProfile) $newPromptOverride
        Set-Content -path $profile  -value $newProfile -Force
    } catch {
      try {
        if($oldProfile){ Set-Content -path $PROFILE -value $oldProfile -Force }
      catch {}



Software Author(s)

  • Keith Dahlby
  • Mark Embling
  • Jeremy Skinner


Version History

Version Downloads Last updated Status
posh-git 5833 Saturday, May 23, 2015 approved
posh-git 11528 Thursday, October 9, 2014 approved
posh-git 12375 Tuesday, July 17, 2012  
posh-git 0.4.0 359 Monday, May 14, 2012  
posh-git 397 Friday, February 3, 2012  
posh-git 368 Tuesday, August 23, 2011  
posh-git 0.3 217 Tuesday, August 23, 2011  

Discussion for the posh-git Package

Ground rules:

  • This discussion is only about posh-git and the posh-git package. If you have feedback for chocolatey, please contact the google group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or posh-git, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.

comments powered by Disqus