måndag 3 september 2012

GitHub powershell prompt

Tired of the GitHub powershell prompt printing the whole path of the working directory, instead of just the name of it? I.e.:
C:\Users\Christian\Documents\GitHub\Wint [master]>
I don't want to change the window/buffer size of my console window just so that the prompt fits into it. Turns out it's relatively simple to fix. Just open up profile.example.ps1 which is located in a folder such as c:\Users\Christian\AppData\Local\GitHub\PoshGit_<some_hash>\, and change the Write-Host line into this:
Write-Host(split-path -path $pwd -leaf) -nonewline
Now you've got a nice prompt saying:
Wint [master]>
Nice and easy! :)

(Not sure if this is going to last for ever though, I guess GitHub will change the name of profile.example.ps1 into something better in the future...)

Inga kommentarer: