如果您不想学习zsh,我建议您使用另一种语言(如python)进行这种解析。
退房 git status Python parser 以及 zsh-git-prompt project 在Github上看看如何得到一个 zsh 提示Git。
zsh