-
Notifications
You must be signed in to change notification settings - Fork 232
/
git_bashrc
30 lines (21 loc) · 1.18 KB
/
git_bashrc
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
# Terminal Snippet to show current branch
# To apply, use $> . ~/.bashrc
#########################################################################################
# function hasBranch {
# git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/{\1}/"
# }
function isSvn {
test -d .svn && echo "(svn)"
}
# PS1="\[\e[0;33m\]\u@\h \[\e[0;37m\](\D{%d-%m-%Y} \A)\[\e[0;32m\]: \w \[\e[1;33m\]\$(hasBranch)\$(isSvn) \n\[\e[0;33m\]\$ \[\e[0m\]"
alias git_log="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias git_log_simple="git log --oneline --graph --decorate"
alias gitl="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white) %an%C(reset)' --all"
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
NO_COLOR="\[\033[0m\]"
PS1="$GREEN\u@\h$NO_COLOR:\w$YELLOW\$(parse_git_branch)$NO_COLOR\$ "