diff --git a/powershell/git.ps1 b/powershell/git.ps1 new file mode 100644 index 00000000..b914789d --- /dev/null +++ b/powershell/git.ps1 @@ -0,0 +1,31 @@ +function Get-GitStatus { & git status -sb $args } +New-Alias -Name gs -Value Get-GitStatus -Force -Option AllScope + +function Get-GitCommit { & git commit -ev $args } +New-Alias -Name gc -Value Get-GitCommit -Force -Option AllScope + +function Get-GitAdd { & git add --all $args } +New-Alias -Name ga -Value Get-GitAdd -Force -Option AllScope + +function Get-GitTree { & git log --graph --oneline --decorate $args } +New-Alias -Name gt -Value Get-GitTree -Force -Option AllScope + +function Get-GitPush { & git push $args } +New-Alias -Name gps -Value Get-GitPush -Force -Option AllScope + +function Get-GitPull { & git pull $args } +New-Alias -Name gpl -Value Get-GitPull -Force -Option AllScope + +function Get-GitFetch { & git fetch $args } +New-Alias -Name gf -Value Get-GitFetch -Force -Option AllScope + +function Get-GitCheckout { & git checkout $args } +New-Alias -Name gco -Value Get-GitCheckout -Force -Option AllScope + +function Get-GitBranch { & git branch $args } +New-Alias -Name gb -Value Get-GitBranch -Force -Option AllScope + +function Get-GitRemote { & git remote -v $args } +New-Alias -Name gr -Value Get-GitRemote -Force -Option AllScope + +# vim:ft=ps1 diff --git a/powershell/prompt.ps1 b/powershell/prompt.ps1 new file mode 100644 index 00000000..c06d4b49 --- /dev/null +++ b/powershell/prompt.ps1 @@ -0,0 +1,18 @@ +function prompt { + $prompt_str = "" + + # GIT branch + $git_prompt = git branch | foreach { if ($_ -match "^\*(.*)"){ $matches[1] } } + $prompt_str += "$git_prompt || " + + # Python + $py_prompt = python --version + $prompt_str += "$py_prompt || " + + # short path + $p = Split-Path -leaf -path (Get-Location) + $prompt_str += "$p" + + Write-Host ($prompt_str) + return "" +}