Tigraine

Daniel Hoelbling-Inzko talks about programming

Displaying git branch in your powershell prompt

Posted by Daniel Hölbling on May 16, 2010

When I started out with git I didn’t start using the commandline right away. I fiddled around with TortoiseGit and GitGui quite a bit before I found out that it’s just so much faster to do all those things from the commandline. As we all know, the windows commandline is not the most powerful thing on the planet, but I also loathe the unix commandline that comes installed with git (gitbash). Obviously, the only alternative is Powershell so I went with that and am very happy with it.

One thing though: I envied Linux users who could extend their bash prompt to display git specific information directly on the shell. Well, after a bit of digging and through some Stackoverflow articles, I managed to find this:

image

Powershell is quite extensible, and by placing a file called Microsoft.PowerSehll_profile.ps1 in your Documents\WindowsPowerShell folder you can define a function called prompt that allows you to modify your prompt text.

I’ve been using this now for quite some time, so I can’t recall where I found the script before I modified it, but here it is anyway (credit goes to whoever created it in the first place): Microsoft.PowerShell_profile.ps1.

Filed under programmierung, git
comments powered by Disqus

My Photography business

Projects

dynamic css for .NET

Archives

more