-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.bash_profile
153 lines (124 loc) · 3.96 KB
/
.bash_profile
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH=$PATH:~/bin
export PATH=/usr/local/bin:$PATH
#!/bin/bash
function _my_rvm_ruby_version {
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
[ "$gemset" != "" ] && echo "[@$gemset]"
}
# http://nuts-and-bolts-of-cakephp.com/2010/11/27/show-git-branch-in-your-bash-prompt/
function _parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
bash_prompt() {
local W="\[\033[0;37m\]"
local R="\[\033[0;31m\]"
PS1="$R\$(_my_rvm_ruby_version)$W[\W]$R\$(_parse_git_branch)\e[m"
}
bash_prompt
unset bash_prompt
# History Tweaks
HISTCONTROL=ignoredups:ignorespace
HISTSIZE=1000
HISTFILESIZE=2000
# source ~/.bash_git_ps1.sh
# source ~/.bash_rc
# Bash completion
# source /Users/omar/.rvm/scripts/completion
rvmdodo () {
echo "==> rvmsudo moov server ." $1
rvmsudo moov server . $1
}
# Checking out a branch
# git checkout <specific branch>
# i.e. $ gc stage
gc () {
echo "==> git checkout" $1
git checkout $1
}
# Pulling remote updates from a specific branch to current branch
# git pull origin <specific branch>
# i.e. $ gp master
gp () {
echo "==> git pull origin" $1
git pull origin $1
}
# Pulling remote updates from a specific branch to current branch
# git pull origin <specific branch>
# i.e. $ gp master
gp () {
echo "==> git pull origin" $1
git pull origin $1
}
# Pushing local updates from a specific branch to remote
# git push origin <specific branch>
# i.e. $ gpu master
gpu () {
echo "==> git push origin" $1
git push origin $1
}
# For updating the current branch
# git pull origin <specific branch 1> & git push origin <specific branch 1>
# i.e. $ gu master
gu () {
echo "==> git pull origin" $1
git pull origin $1
if [ $? -ne 0 ] ; then
echo "==> Can't intiate PUSH, revise local repo"
else
echo "==> git push origin" $1
git push origin $1
fi
}
# Merge branch 'a' to branch 'b'
# i.e. gmb master deploy
gmb () {
if [[ $1 && $2 ]] ; then
# Remember the branch the user was on
local current_branch=`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`;
# Make it pretty with some colors
local R="\033[0;31m"
local W="\033[0;37m"
# Checkout the $1 and update it
echo -e "\n$R==> git checkout" $1 $W
git checkout $1
# Check if the 'git checkout' was succesfull
if [ $? -ne 0 ] ; then
echo -e "\n$R==> Cannot proceed, double check your repo and make sure you have committed all your changes. \n Also check if the branch you speicified exists." $W
else
echo -e "\n$R==> git pull origin" $1 $W
git pull origin $1
echo -e "\n$R==> git push origin" $1 $W
git push origin $1
# Checkout $2 and update then merge $1 into it
echo -e "\n$R==> git checkout" $2 $W
git checkout $2
if [ $? -ne 0 ] ; then
echo -e "\n$R==> Cannot proceed, double check your repo and make sure you have committed all your changes. \n Also check if the branch you speicified exists." $W
else
echo -e "\n$R==> git pull origin" $2 $W
git pull origin $2
echo -e "\n$R==> git merge" $1 $W
git merge $1
echo -e "\n$R==> git push origin" $2 $W
git push origin $2
echo -e "\n$R==> git checkout" $current_branch $W
git checkout $current_branch;
fi
fi
else
echo "Please specifiy two branchs. i.e. \$ gmb master deploy"
fi
}
# Lists file in more clear format
# Stands for: Super ls
sls () {
ls -A1p
}
#- end
##
# Your previous /Users/omarjalalzada/.bash_profile file was backed up as /Users/omarjalalzada/.bash_profile.macports-saved_2012-12-31_at_03:52:28
##
# MacPorts Installer addition on 2012-12-31_at_03:52:28: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.