Created
August 18, 2014 16:13
-
-
Save feanz/8f7d98051df25208c141 to your computer and use it in GitHub Desktop.
Powersehll profile
This file contains hidden or 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
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent) | |
# Load posh-git module from current default module locaiton | |
Import-Module posh-git | |
# Set up a simple prompt, adding the git prompt parts inside git repos | |
function global:prompt { | |
$realLASTEXITCODE = $LASTEXITCODE | |
# Reset color, which can be messed up by Enable-GitColors | |
$Host.UI.RawUI.ForegroundColor = $GitPromptSettings.DefaultForegroundColor | |
Write-Host($pwd.ProviderPath) -nonewline | |
Write-VcsStatus | |
$global:LASTEXITCODE = $realLASTEXITCODE | |
return "> " | |
} | |
function gh{ | |
$url = & git config --get remote.origin.url | |
$url = $url.TrimEnd(".git") | |
$branch = & git symbolic-ref HEAD | |
Write-Host "On Branch" $branch | |
$branch = $branch.Substring(11,($branch.length-11)) | |
Write-Host $branch | |
$url = $url.ToString() + "/tree/" + $branch.ToString() | |
Write-Host "Opening" $url | |
[System.Diagnostics.Process]::Start($url) | |
return | |
} | |
function gh-pull{ | |
$url = & git config --get remote.origin.url | |
$url = $url.TrimEnd(".git") | |
$url = $url.ToString() + "/pulls" | |
Write-Host "Opening" $url | |
[System.Diagnostics.Process]::Start($url) | |
return | |
} | |
Enable-GitColors | |
Pop-Location | |
Start-SshAgent -Quiet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment