Skip to content

Instantly share code, notes, and snippets.

@djleeds
Created July 16, 2025 01:07
Show Gist options
  • Save djleeds/7b8905f2efd485153a86a0edffa20850 to your computer and use it in GitHub Desktop.
Save djleeds/7b8905f2efd485153a86a0edffa20850 to your computer and use it in GitHub Desktop.
Update posh-git to include spaces after commands, remotes, and branches
# posh-git on Windows doesn't add spaces during auto-complete like Git Bash does.
# You can edit your local instance of posh-git to add them.
#
# Find this File:
# <YourUserFolder>\Documents\PowerShell\Modules\posh-git\1.1.0\src\GitTabExpansion.ps1
# Update gitCommands() to end with this:
$cmdList | Sort-Object | ForEach-Object { $_ + ' ' }
# Update gitRemotes() like this:
function script:gitRemotes($filter) {
git remote |
Where-Object { $_ -like "$filter*" } |
quoteStringWithSpecialChars |
ForEach-Object { $_ + ' ' }
}
# Update gitBranches() to end with this:
$branches |
Where-Object { $_ -ne '(no branch)' -and $_ -like "$filter*" } |
ForEach-Object { $prefix + $_ } |
quoteStringWithSpecialChars |
ForEach-Object { $_ + ' ' }
# After making the changes, you'll need to close and re-open PowerShell.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment