Skip to content

Instantly share code, notes, and snippets.

@ssboisen
Created June 28, 2012 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssboisen/3009391 to your computer and use it in GitHub Desktop.
Save ssboisen/3009391 to your computer and use it in GitHub Desktop.
Wrap-Git
$psgit = @{
'tb' = "git branch -r --no-color |
where { `$_ -match ' (?<fb>origin/(?<b>#1.+))' } |
% { git branch --set-upstream `$matches['b'] `$matches['fb'] }";
}
Set-Alias git Wrap-Git
function Wrap-Git {
if (-not $psgit.ContainsKey($args[0])) {
git.exe $args
} else {
$command = $psgit[$args[0]]
for($i = 1; $i -le $args.length;$i++) {
$command = $command.Replace("#$i", $args[$i]);
}
invoke-expression $command
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment