Add Git Branch Name to Terminal Prompt (MacOS Catalina zsh) Open ~/.zshrc in your favorite editor and add the following content to the bottom. function parse_git_branch() { git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p' }