zsh: Add Git commit SHA to prompt
This commit is contained in:
parent
18e81f9bd6
commit
b71aec495a
|
@ -22,10 +22,15 @@ git_prompt_info() {
|
||||||
! git_is_repo || return
|
! git_is_repo || return
|
||||||
|
|
||||||
current_branch=$(git_current_branch 2> /dev/null)
|
current_branch=$(git_current_branch 2> /dev/null)
|
||||||
|
current_commit=$(git rev-parse --short HEAD 2> /dev/null)
|
||||||
suffix=''
|
suffix=''
|
||||||
|
|
||||||
|
if [[ ! -z ${current_commit} ]]; then
|
||||||
|
suffix="${suffix} %{$fg_bold[yellow]%}[${current_commit}]%{$reset_color%}"
|
||||||
|
fi
|
||||||
|
|
||||||
if git_repo_is_dirty; then
|
if git_repo_is_dirty; then
|
||||||
suffix=" %{$fg_bold[red]%}*%{$reset_color%}"
|
suffix="${suffix} %{$fg_bold[red]%}*%{$reset_color%}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n git_current_branch ]]; then
|
if [[ -n git_current_branch ]]; then
|
||||||
|
|
Loading…
Reference in a new issue