If you work with git as your version control system and don’t use a GUI app in your workflow, this one liner in your ~/.profile (or ~/.bashrc on Linux) will display the active branch you’re working on when you cd to a git repo path.
PS1="\u@\h:\w\$(git branch 2>/dev/null | grep -e '\* ' | sed 's/^..\(.*\)/{\1}/') \$ "
Login again and your shell will display the following when you move into a git repo:
greg@macbook:~ $ cd code/
greg@macbook:~/code $ cd weblog/
greg@macbook:~/code/weblog{wordpress} $
Update: In hindsight, better advice would be the install Oh My zsh where you get all this and more as standard. While you’re at it I recommend switching to iTerm2.

You can skip to the end and leave a response. Pinging is currently not allowed.
comments
No comments for this post. Be the first to respond!