I'm trying to get my iTerm prompt set up the same way as Paul Irish
So far I have the following in ~/.profile
:
# Add git branch name to prompt parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/*\(.*\)/ on \1/' } PS1='\n\[\033[0:35m\]\u\[\033[0;32m\]\w\[033[0m\]$(parse_git_branch)\n\$\[\033[0m\] '
I don't know how to make just the branch appear in a different colour and not the preceding "on"
As well as this there are other features such as:
Any help would be appreciated
I use git-aware-prompt.
A lot of solutions I had before only displayed the git branch if I were only in that directory when the terminal loaded. If I started iTerm in a non-git repo, then it wouldn't work when I cd
into directory with a git repo.
This github project solved that for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With