Powershell Profile
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
# Load posh-git module from current default module locaiton
Import-Module posh-git
#Load PSReadline
Import-Module PSReadLine
# 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
}
#aliase hub
new-alias git hub.exe
Pop-Location
# Load posh-git example profile
. 'C:\Users\richa_000\Documents\WindowsPowerShell\Modules\posh-git\profile.example.ps1'
Set-PSReadlineKeyHandler -Key Tab -Function Complete