First, setup a git alias:
% git config --global alias.project-name 'config --replace-all project.info.name'Use it like this (your CWD should be a git project):
% git project-name "NodeJS Latest"Review the setting with:
% git config --local --get project.info.nameIn your bash profile:
export PROMPT_COMMAND="echo -ne \"\033]0;\$(git config --get project.info.name || $PROMPT_COMMAND)\007\"; $PROMPT_COMMAND"Your terminal tab when you are within a configured project:
Your terminal tab when you are not in a configured project:


Thanks for this; I adapted heavily for a zsh setup, but use this happily. In zsh, the
chpwd_functionsarray variable can hold names of functions to be invoked whenever you change directory (unless it's a "quiet" change). This lets me uselocal prj="[$(git config --get project.info.name)]"and then, if that's[], replace withprj=${$(git rev-parse --show-toplevel):t}to get the project.Then check
[[ $(git rev-parse --is-inside-git-dir) = true ]]to either sethere="[git-dir]"orhere="$(git rev-parse --show-prefix)"and justprint -Pn '\e]2;'"git:${prj}:${here}"'\a'