Skip to content


Git in your terminal title

Putting your current git branch into your terminal title is simple if you use the git-branch and PROMPT_COMMAND

export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~} git-branch 2>&1 | grep "*" | awk -F" " "{print $2}""; echo -ne "\007"'

Update

If you have git bash_completion installed, you can modify your PROMPT_COMMAND to this:

export PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/~} $(__git_ps1 " (%s)")"; echo -ne "\007"'

Thanks for the tip Martin.

Posted in Uncategorized.