Now that zsh is the default shell on Mac OS terminal, you might want to setup you new Mac or VS Code terminal to have a smart integration with git, something similar to git bash for Windows.

After searching around for a while and finding tools to integrate with bash, I finally found this article that offers an explanation on how to integrate git with zsh in Mac OS Terminal (or shell).

Since zsh ships with a framework for getting information from version control systems, called vcs_info, you can include the branch name in the prompt on the right side, add these lines to your ~/.zshrc file:

autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
setopt prompt_subst
# PROMPT='${vcs_info_msg_0_}%# '
zstyle ':vcs_info:git:*' formats '%b'

Zsh is powerful enough that there are entire frameworks dedicated to making it better. One of them is called oh-my-zsh. oh-my-zsh’s plugin system comes with powerful git tab-completion, and it has a variety of prompt “themes”, many of which display version-control data.

You can install oh-my-zsh running fhe following command:

sh -c "$(curl -fsSL"

Enjoy your new zsh terminal integrated with git commands!