# Title setting function function git_title { # See if we're in a git path if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) = true ]]; then # Set the title to : like "mycoollib:master" echo -ne "\033]0;$(basename `git rev-parse --show-toplevel`):$(git rev-parse --abbrev-ref HEAD)\007" else # Set the title to the present working directory echo -ne "\033]0;$PWD\007" fi } PROMPT_COMMAND=git_title