Created
June 28, 2012 05:56
-
-
Save ssboisen/3009391 to your computer and use it in GitHub Desktop.
Wrap-Git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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