mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Adds tracking of ahead local commits from remote
This commit is contained in:
parent
1389a1178a
commit
6442cf66c4
102 changed files with 9 additions and 2 deletions
|
|
@ -9,9 +9,16 @@ function git_prompt_sha() {
|
|||
echo "%{$fg[white]%}[%{$fg[yellow]%}"$sha"%{$fg[white]%}]"
|
||||
}
|
||||
|
||||
# Checks if there are commits ahead from remote
|
||||
function git_parse_ahead() {
|
||||
if $(echo "$(git log origin/master..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
echo " %{$fg[red]%}(!)"
|
||||
fi
|
||||
}
|
||||
|
||||
# Prompts
|
||||
PROMPT='
|
||||
%{$fg_bold[green]%}%n@%m%{$fg[white]%}:%{$fg[yellow]%}%~%u$(parse_git_dirty)%{$reset_color%}
|
||||
%{$fg_bold[green]%}%n@%m%{$fg[white]%}:%{$fg[yellow]%}%~%u$(parse_git_dirty)$(git_parse_ahead)%{$reset_color%}
|
||||
%{$fg[blue]%}>%{$reset_color%} '
|
||||
RPROMPT='%{$fg_bold[green]%}$(current_branch) $(git_prompt_sha) $(git_prompt_status)%{$reset_color%}'
|
||||
|
||||
|
|
@ -22,6 +29,6 @@ ZSH_THEME_GIT_PROMPT_DELETED=" %{$fg[red]%}deleted "
|
|||
ZSH_THEME_GIT_PROMPT_RENAMED=" %{$fg[yellow]%}renamed "
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED=" %{$fg[yellow]%}modified "
|
||||
ZSH_THEME_GIT_PROMPT_ADDED=" %{$fg[green]%}added "
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$fg[white]%}untracked "
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED=""
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}(*)"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
Loading…
Add table
Add a link
Reference in a new issue