-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions
64 lines (51 loc) · 1.24 KB
/
functions
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
# Switch to a gem directory, trying to match your name the best
function cdgem {
gem_dir=`gem env | grep INSTALLATION | cut -d' ' -f6`
cd $gem_dir/gems
cd `ls|grep $1|sort|tail -1`
}
function sgi {
sudo gem install $1
}
function glg {
gem list | grep $1
}
function rrg {
bundle exec rake routes | grep $1
}
function zrrg {
bundle exec zeus rake routes | grep $1
}
#################
# git stuff #
#################
function parse_git_branch {
val=`git_branch_name | sed 's_\(.*\)_(\1)_'`
echo "$val"
}
function git-new-remote-tracking {
git checkout -b $1 && git push -u origin $1
}
function git_branch_name {
val=`git branch 2>/dev/null | grep '^*' | colrm 1 2`
echo "$val"
}
function git-done {
branch=`git_branch_name`
git checkout master && git pull --rebase
git checkout $branch && git rebase master && git checkout master && git merge $branch && bundle install && bundle exec rake db:migrate && bundle exec rake && git push && git branch -d $branch && git push origin :$branch
}
function git-nuke {
git branch -D $1 && git push origin :$1
}
# Creating a remote tracking branch
function track {
git branch --track $1 "origin/$1"
}
function g {
if [[ $# > 0 ]]; then
git $@
else
git status
fi
}