GIT – Afficher la branche courante dans le terminal de MacOS
Ajouter ces lignes de configs dans le fichier ~/.zshrc
Ouvrir ~/.zshrc dans le terminal
function parse_git_branch() {
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}
COLOR_DEF=$'%f'
COLOR_USR=$'%F{243}'
COLOR_DIR=$'%F{197}'
COLOR_GIT=$'%F{39}'
setopt PROMPT_SUBST
export PROMPT='${COLOR_USR}%n ${COLOR_DIR}%~ ${COLOR_GIT}$(parse_git_branch)${COLOR_DEF} $ 'Langage du code : Bash (bash)
Recharger le shell:
source ~/.zshrc