0

I have recently decided to fully learn Git, and it has become unimaginably helpful in my everyday life.

I have customized my zsh profile to this currently: current zsh profile

Would it be possible, without installing any 3rd-party tools such as OhMyZsh, to display something next to the git_branch in the zsh profile in different colors for the status of a commit? Such as green text for a committed change, yellow for staged, and red for not staged?

I am on macOS.

Here is my current ~/.zshrc:

function parse_git_branch() {
    git branch --show-current 2> /dev/null
}

setopt PROMPT_SUBST

export PROMPT='%F{cyan}%n%f %F{027}%1~%f %F{055}$(parse_git_branch)%f                     
%F{green}$%f '
  • 1
    I think you wanted to say 'prompt', not profile. There are several questions [here on SO](https://stackoverflow.com/search?q=%5Bzsh%5D+prompt+git) and on [stack exchange](https://unix.stackexchange.com/search?q=%5Bzsh%5D+prompt+git) that discuss how to use the `vcs_info` builtin in `zsh` to create a git-aware prompt. Including [this](https://stackoverflow.com/a/66104574/9307265), [this](https://stackoverflow.com/q/69357323/9307265), and [this one](https://stackoverflow.com/q/69687223/9307265). – Gairfowl Nov 16 '21 at 05:36

0 Answers0