What is it for? Used to view which branch you are in via the terminal without having to run 'git status'
- Open the .zshrc file:
nano ~/.zshrc- Add or modify the code at the end of the file:
# Alias
alias gs='git status'
alias cls='clear'
# Git
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
# Configuring vcs_info for Git
zstyle ':vcs_info:git:*' formats 'on %F{011}⎇ %b%f'
zstyle ':vcs_info:*' enable git
setopt PROMPT_SUBST
PROMPT='%F{040}%n%f at %F{166}%m%f in %F{031}${PWD/#$HOME/~}%f ${vcs_info_msg_0_}'-
Save and close the file: Press CTRL+O to save and CTRL+X to close nano.
-
Reload the .zshrc file:
source ~/.zshrc