We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
0 parents commit f5a75aeCopy full SHA for f5a75ae
bash-git-prompt
@@ -0,0 +1,22 @@
1
+#!/usr/bin/env bash
2
+
3
+# bash git prompt
4
+GIT_PS1_SHOWDIRTYSTATE=true
5
+GIT_PS1_SHOWUNTRACKEDFILES=true
6
+GIT_PS1_SHOWUPSTREAM="verbose"
7
8
+__git_ps1_improved() {
9
+ local git_current_branch_name="\$(__git_ps1 '%s' | sed 's/ .\+//' | sed -e 's/[\\\\/&]/\\\\\\\\&/g')"
10
+ local git_status_substitutes=(
11
+ "s/$git_current_branch_name//;" # remove branch temporarily
12
+ "s/u//;" # upstream
13
+ "s/+\([0-9]\+\)/↑\1/;" # outgoing
14
+ "s/-\([0-9]\+\)/↓\1/;" # incoming
15
+ "s/%/?/;" # untracked
16
+ "s/+/✓/;" # staged
17
+ "s/*/✕/;" # unstaged
18
+ "s/\(.*\)/⑂ $git_current_branch_name\1/;" # insert branch again
19
+ )
20
21
+ echo "\$(__git_ps1 '%s'| sed \"${git_status_substitutes[@]}\")"
22
+}
0 commit comments