-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vcs_git
57 lines (52 loc) · 1.36 KB
/
.vcs_git
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# bashrc extra functions written for AOSC OSes, package "git"
# by Arthur Wang
# Aliases, mostly from http://blog.sina.com.cn/s/blog_630c58cb01011uid.html
alias g="git status"
alias ga="git add"
alias gaa="git add ."
alias gau="git add -u"
alias gct="git commit"
alias gcm="git commit -m"
alias gca="git commit -am"
alias gb="git branch"
alias gbd="git branch -d"
alias gco="git checkout"
alias gcob="git checkout -b"
alias gt="git stash"
alias gta="git stash apply"
alias gmg="git merge"
alias gr="git rebase"
alias gl="git log --oneline --decorate --graph"
alias gsh="git show"
alias gd="git diff"
alias gdc="git diff --cached"
alias gbl="git blame"
alias gps="git push"
alias gpl="git pull"
# Prompt
alias __ps1_git_branch="bash-git-status"
_ps1_git_status() {
local bgs
bgs=$(bash-git-status)
case "$?" in
5)
echo -e "\01\e[1m\02@\01\e[0;32m\0002$bgs\01\e[0m\02"
;;
6)
echo -e "\01\e[1m\02@\01$IRED\0002$bgs\01\e[0m\02"
;;
7)
echo -e "\01\e[1m\02@\01\e[0;35m\0002$bgs\01\e[0m\02"
;;
8)
echo -e "\01\e[1m\02@\01\e[0;37m\0002$bgs\01\e[0m\02"
;;
9)
echo -e "\01\e[1m\02@\01\e[0;32m\0002$bgs\01\e[0m\02"
;;
esac
}
# A shorter one without color
# alias _git_status='_st="$(__git_branch)"; ((!PIPESTATUS[0])) && echo "@$_st"'
# For users of the contrib/completion __git_ps1
# _git_status(){ git branch &>/dev/null || return 1; echo -n ' '; __git_ps1; }