@ -137,10 +137,10 @@ function git-info() {
local branch_info
local branch_info
local branch_format
local branch_format
local branch_formatted
local branch_formatted
local branch_is_set
local clean
local clean
local clean_formatted
local clean_formatted
local commit
local commit
local commit_short
local commit_format
local commit_format
local deleted=0
local deleted=0
local deleted_format
local deleted_format
@ -219,9 +219,8 @@ function git-info() {
commit="$(git rev-parse HEAD 2>/dev/null)"
commit="$(git rev-parse HEAD 2>/dev/null)"
# Format commit (short).
# Format commit (short).
commit_short="$commit[1,7]"
zstyle -s ':omz:plugin:git:prompt' commit 'commit_format'
zstyle -s ':omz:plugin:git:prompt' commit 'commit_format'
zformat -f commit_formatted "$commit_format" "c:$commit_short "
zformat -f commit_formatted "$commit_format" "c:$commit"
# Stashed
# Stashed
if [[ -f "$(_git-dir)/refs/stash" ]]; then
if [[ -f "$(_git-dir)/refs/stash" ]]; then
@ -237,9 +236,6 @@ function git-info() {
(( line_number++ ))
(( line_number++ ))
if (( line_number == 1 )) && [[ "$line" == *'(no branch)'* ]]; then
if (( line_number == 1 )) && [[ "$line" == *'(no branch)'* ]]; then
# Set branch to commit (short) when the branch is not found.
branch="$commit_short"
# Get action.
# Get action.
action="$(_git-action)"
action="$(_git-action)"
if [[ -n "$action" ]]; then
if [[ -n "$action" ]]; then
@ -298,6 +294,7 @@ function git-info() {
# Format branch.
# Format branch.
zstyle -s ':omz:plugin:git:prompt' branch 'branch_format'
zstyle -s ':omz:plugin:git:prompt' branch 'branch_format'
zformat -f branch_formatted "$branch_format" "b:$branch"
zformat -f branch_formatted "$branch_format" "b:$branch"
branch_is_set=$#branch
# Format remote.
# Format remote.
if [[ "$branch" != "$commit" ]]; then
if [[ "$branch" != "$commit" ]]; then
@ -379,6 +376,7 @@ function git-info() {
"c:$commit_formatted" \
"c:$commit_formatted" \
"d:$deleted_formatted" \
"d:$deleted_formatted" \
"D:$dirty_formatted" \
"D:$dirty_formatted" \
"h:$branch_is_set" \
"m:$modified_formatted" \
"m:$modified_formatted" \
"R:$remote_formatted" \
"R:$remote_formatted" \
"r:$renamed_formatted" \
"r:$renamed_formatted" \