-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.bashrc
112 lines (88 loc) · 2.26 KB
/
.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
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# .bashrc
export EDITOR=vim
PATH="/Users/$(whoami)/bin:$PATH:/usr/local/bin:/usr/local/sbin:$PATH"
export PATH=$PATH
# z script https://github.com/rupa/z.git
if [ -f ~/bin/z/s.sh ]; then
. ~/bin/z/z.sh
# alias zadd="_z --add \"\$(pwd -P 2>/dev/null)\" 2>/dev/null;"
fi
if command -v yarn > /dev/null; then
export PATH="$PATH:`yarn global bin`"
fi
# python
if command -v pyenv > /dev/null; then
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
fi
# Ruby
if command -v rbenv > /dev/null; then
eval "$(rbenv init -)"
fi
# nvm source ~/.nvm/nvm.sh
export NVM_DIR="/Users/$(whoami)/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
# ssh
ssh-add -A &> /dev/null
export GIT_SSH_COMMAND='ssh -i ~/.ssh/id_rsa'
# tmux
#export TMUX_TMPDIR=/usr/local/var/tmux-sessions
flipTable(){
echo "(╯°□°)╯︵ ┻━┻"
}
# prompt
showBranch(){
if [$(pwd | grep "code|www") != ""]; then
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/±\1/'
# | tr "\n" ' '
fi
}
#export PS1='\e[01;32m\u\e[34m@\H \e[01;31m\w \e[32;40m$(showBranch) \n\[\e[30m\]\[\e[33m\]⚡ \[\e[0m\]'
export PS1='\e[01;32m\h \e[01;31m\w \e[34m$(showBranch) \n\[\e[30m\]\[\e[33m\]⚡ \[\e[0m\]'
# fix error with installing pg gem
export ARCHFLAGS="-arch x86_64"
# Aliases
if [ -f ~/.bash_aliases ]; then
source ~/.bash_aliases
fi
alias sq=squash
alias cb=current_branch
alias pushf=force_push
# Local settings
if [ -f ~/.bash_local ]; then
source ~/.bash_local
fi
squash(){
git rebase -i HEAD~$1
}
current_branch(){
gb 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
hist(){
git log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short -$1
}
last(){
git log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short -1
}
changed(){
git show --pretty="format:" --name-only $1
}
sync(){
gf --all && co master && pull && gs && last
}
blam(){
push origin $(cb) $@
}
syncup(){
gf --all && co master && pullup && blam && gs && last
#co develop && pulldev && blam && gs && last
}
force_push(){
branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ $branch == "master" ]; then
echo "*** [Policy] never force push master"
else
echo "*** Force push branch: $branch to origin"
push --force-with-lease origin $branch
fi
}