File tree 2 files changed +9
-11
lines changed
2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ master ✕✓? ↑1↓5
19
19
...with the original git prompt
20
20
21
21
``` bash
22
- master * +% u+1-5
22
+ master * +%| u+1-5
23
23
```
24
24
25
25
## Usage
Original file line number Diff line number Diff line change @@ -6,17 +6,15 @@ GIT_PS1_SHOWUNTRACKEDFILES=true
6
6
GIT_PS1_SHOWUPSTREAM=" verbose"
7
7
8
8
__git_ps1_improved () {
9
- local git_current_branch_name=" \$ (__git_ps1 '%s' | sed 's/ .\+//' | sed -e 's/[\\\\ /&]/\\\\\\\\ &/g')"
10
9
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
10
+ " s/|u=/ =/;" # equal to upstream
11
+ " s/|u+\([0-9]\+\)-\([0-9]\+\)/ ↑\1↓\2/;" # diverged from upstream
12
+ " s/|u+\([0-9]\+\)/ ↑\1/;" # ahead of upstream
13
+ " s/|u-\([0-9]\+\)/ ↓\1/;" # behind upstream
14
+ " s/%/?/;" # untracked
15
+ " s/+/✓/;" # staged
16
+ " s/*/✕/;" # unstaged
19
17
)
20
18
21
- echo " \$ (__git_ps1 '%s'| sed \" ${git_status_substitutes[@]} \" )"
19
+ echo " ⑂ \$ (__git_ps1 '%s'| sed \" ${git_status_substitutes[@]} \" )"
22
20
}
You can’t perform that action at this time.
0 commit comments