Colorized git-prompt-help with configured colors and symbols

master
Martin Gondermann 12 years ago committed by Martin Gondermann
parent 5c49f42858
commit 74f9786745
  1. 38
      git-prompt-help.sh

@ -3,7 +3,7 @@
# being displayed.
git_prompt_help() {
cat <<EOF 1>&2
cat <<EOF | sed 's/\\\[\\033//g' | sed 's/\\\]//g'
The git prompt format is [<BRANCH><TRACKING>|<LOCALSTATUS>]
BRANCH is a branch name, such as "master" or "stage", a tag name, or commit
@ -12,44 +12,46 @@ hash prefixed with ':'.
TRACKING indicates how the local branch differs from the
remote branch. It can be empty, or one of:
↑N - ahead of remote by N commits
↓N - behind remote by N commits
↓M↑N - branches diverged, other by M commits, yours by N commits
${GIT_PROMPT_BRANCH}${GIT_PROMPT_REMOTE}↑N${ResetColor} - ahead of remote by N commits
${GIT_PROMPT_BRANCH}${GIT_PROMPT_REMOTE}↓N${ResetColor} - behind remote by N commits
${GIT_PROMPT_BRANCH}${GIT_PROMPT_REMOTE}↓M↑N${ResetColor} - branches diverged, other by M commits, yours by N commits
LOCALSTATUS is one of the following:
- repository clean
●N - N staged files
✖N - N unmerged files
✚N - N changed but *unstaged* files
…N - N untracked files
⚑N - N stash entries
${GIT_PROMPT_CLEAN}${ResetColor} - repository clean
${GIT_PROMPT_STAGED}N${ResetColor} - N staged files
${GIT_PROMPT_CONFLICTS}N${ResetColor} - N conflicted files
${GIT_PROMPT_CHANGED}N${ResetColor} - N changed but *unstaged* files
${GIT_PROMPT_UNTRACKED}N${ResetColor} - N untracked files
${GIT_PROMPT_STASHED}N${ResetColor} - N stash entries
See "git_prompt_examples" for examples.
EOF
}
help_git_prompt() { git_prompt_help ; }
git_prompt_examples() {
cat <<EOF 1>&2
cat <<EOF | sed 's/\\\[\\033//g' | sed 's/\\\]//g'
These are examples of the git prompt:
(master↑3|✚1) - on branch "master", ahead of remote by 3 commits, 1
[${GIT_PROMPT_BRANCH}master${GIT_PROMPT_REMOTE}↑3${ResetColor}|${GIT_PROMPT_CHANGED}1${ResetColor}] - on branch "master", ahead of remote by 3 commits, 1
file changed but not staged
(status|●2) - on branch "status", 2 files staged
[${GIT_PROMPT_BRANCH}status${ResetColor}|${GIT_PROMPT_STAGED}2${ResetColor}] - on branch "status", 2 files staged
(master|✚7…) - on branch "master", 7 files changed, some files untracked
[${GIT_PROMPT_BRANCH}master${ResetColor}|${GIT_PROMPT_CHANGED}7${GIT_PROMPT_UNTRACKED}${ResetColor}] - on branch "master", 7 files changed, some files untracked
(master|✖2✚3) - on branch "master", 2 conflicts, 3 files changed
[${GIT_PROMPT_BRANCH}master${ResetColor}|${GIT_PROMPT_CONFLICTS}2${GIT_PROMPT_CHANGED}3${ResetColor}] - on branch "master", 2 conflicts, 3 files changed
(master|⚑2) - on branch "master", 2 stash entries
[${GIT_PROMPT_BRANCH}master${ResetColor}|${GIT_PROMPT_STASHED}2${ResetColor}] - on branch "master", 2 stash entries
(experimental↓2↑3|) - on branch "experimental"; your branch has diverged
[${GIT_PROMPT_BRANCH}experimental${GIT_PROMPT_REMOTE}↓2↑3${ResetColor}|${GIT_PROMPT_CLEAN}${ResetColor}]
- on branch "experimental"; your branch has diverged
by 3 commits, remote by 2 commits; the repository is
otherwise clean
(:70c2952|) - not on any branch; parent commit has hash "70c2952"; the
[${GIT_PROMPT_BRANCH}:70c2952${ResetColor}|${GIT_PROMPT_CLEAN}${ResetColor}] - not on any branch; parent commit has hash "70c2952"; the
repository is otherwise clean
EOF
}

Loading…
Cancel
Save