Skip to content

Instantly share code, notes, and snippets.

@dennisroche
Last active October 25, 2017 13:31
Show Gist options
  • Save dennisroche/2982c875e0668e04bd83707c4446a811 to your computer and use it in GitHub Desktop.
Save dennisroche/2982c875e0668e04bd83707c4446a811 to your computer and use it in GitHub Desktop.
Expand posh-git alias

Add PowerShell alias to your profile.

function Get-Git { & git $args }
New-Alias g Get-Git -Force -Option AllScope

This will alias g to git, however you forgo the tab expansion.

posh-git shell is replacing default TabExpansion function with own implementation.

To enable tab expansion for the g alias, we need to edit this implemention.

code (Get-Command TabExpansion).ScriptBlock.File

Scroll to the bottom and add the following

function TabExpansion($line, $lastWord) {
    $line = $line -replace '^g ', 'git '
    ...
}
@dennisroche
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment