How can I display my current git branch name in my PowerShell prompt?

前端 未结 7 2095
暗喜
暗喜 2020-11-30 20:18

Basically I\'m after this but for PowerShell instead of bash.

I use git on windows through PowerShell. If possible, I\'d like my current branch name to displayed as

相关标签:
7条回答
  • 2020-11-30 21:00

    From @tamj0rd2's answer we can get the branch name to a string variable like this.

    $branch = git rev-parse --abbrev-ref HEAD
    echo $branch
    
    0 讨论(0)
提交回复
热议问题