Git Prompt
Check the branch you are working on
Git
Download the git-prompt.sh with the curl command.
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -o ~/.git-prompt.shThen add the following lines to the rc files depending on your environment.
.zshrc
source ~/.git-prompt.sh
setopt PROMPT_SUBST
PS1='%n@%m %c%F{green}$(__git_ps1 " (%s)")%f \$ '.bashrc
source ~/.git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
export PS1='\[\e[0;32m\]\u@\h\[\e[0m\] \[\e[0;34m\]\W\[\e[0m\]\[\e[0;33m\]$(__git_ps1 " (%s)")\[\e[0m\] \$ '