Show an uncommitted marker in the git prompt.
This commit is contained in:
parent
7d865daa80
commit
9bac8a06bd
1 changed files with 6 additions and 2 deletions
8
.bashrc
8
.bashrc
|
|
@ -7,8 +7,9 @@ __prompt_git_status() {
|
|||
# GIT_PROMPT_SHOW_TYPE=1 - Show type of repository (Bare, Shallow).
|
||||
# GIT_PROMPT_SHOW_IGNORED=1 - Show a ! if the directory is ignored.
|
||||
# GIT_PROMPT_SHOW_UNSTAGED=1 - Show a * if there are unstaged changes (superceeded by above).
|
||||
# GIT_PROMPT_SHOW_UNCOMMITTED=1 - Show a & if there are staged but uncommitted changes (superceeded by above).
|
||||
# GIT_PROMPT_SHOW_UNTRACKED=1 - Show a ? if there are untracked files in the working directory (superceeded by above).
|
||||
# GIT_PROMPT_SHOW_STASH=1 - Show a & if there is a stash in this repository (superceeded by above).
|
||||
# GIT_PROMPT_SHOW_STASH=1 - Show a $ if there is a stash in this repository (superceeded by above).
|
||||
# GIT_PROMPT_SHOW_UPSTREAM=1 - Show status of this repository compaired to upstream:
|
||||
# ?? - No upstream set.
|
||||
# == - Working tree is equal to upstream.
|
||||
|
|
@ -52,10 +53,12 @@ __prompt_git_status() {
|
|||
GIT_PROMPT+=" !"
|
||||
elif [[ -n "$GIT_PROMPT_SHOW_UNSTAGED" ]] && git ls-files --modified --exclude-standard --directory --error-unmatch -- ':/*' >/dev/null 2>&1; then
|
||||
GIT_PROMPT+=" *"
|
||||
elif [[ -n "$GIT_PROMPT_SHOW_UNCOMMITTED" ]] && ! git diff --name-only --cached --exit-code >/dev/null 2>&1; then
|
||||
GIT_PROMPT+=" &"
|
||||
elif [[ -n "$GIT_PROMPT_SHOW_UNTRACKED" ]] && git ls-files --others --exclude-standard --directory --error-unmatch -- ':/*' >/dev/null 2>&1; then
|
||||
GIT_PROMPT+=" ?"
|
||||
elif [[ -n "$GIT_PROMPT_SHOW_STASH" ]] && git rev-parse --verify --quiet refs/stash >/dev/null; then
|
||||
GIT_PROMPT+=" &"
|
||||
GIT_PROMPT+=" $"
|
||||
fi
|
||||
|
||||
# Get upstream status.
|
||||
|
|
@ -391,6 +394,7 @@ PROMPT_COMMAND="__nanorc_prompt_command; __ssh_agent_prompt_command"
|
|||
GIT_PROMPT_SHOW_TYPE=1
|
||||
GIT_PROMPT_SHOW_IGNORED=1
|
||||
GIT_PROMPT_SHOW_UNSTAGED=1
|
||||
GIT_PROMPT_SHOW_UNCOMMITTED=1
|
||||
GIT_PROMPT_SHOW_UNTRACKED=1
|
||||
GIT_PROMPT_SHOW_STASH=1
|
||||
GIT_PROMPT_SHOW_UPSTREAM=1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue