-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
82 lines (74 loc) · 2.02 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
#!/usr/bin/env bash
# git pull branch by merging
# can be used by:
# gpb -> merges origin/master to current branch
# gpb develop -> merges origin/develop to current branch
# gpb develop upstream -> merges upstream/develop to current branch
gpb() {
# process:
# git checkout master
# git pull origin master
# git checkout currBranch
# git merge master
if [ -d .git ]; then
currBranch=$(git rev-parse --abbrev-ref HEAD);
remote=${2:-"origin"}
branch=${1:-"master"}
if [ "$branch" != "$currBranch" ]; then
git checkout "$branch";
git fetch --prune
git pull "$remote" "$branch";
echo ""
echo "pulled from $remote $branch"
echo ""
git checkout "$currBranch";
git merge "$branch"
echo ""
echo "merged $branch to $currBranch"
else
echo "already on the same branch, pulling from $2"
git pull "$remote" "$branch";
fi
else
echo "not a git repository"
fi;
}
# git pull branch by rebase
# similar to above but uses rebase instead of merge
gpbr() {
if [ -d .git ]; then
currBranch=$(git rev-parse --abbrev-ref HEAD);
remote=${2:-"origin"}
branch=${1:-"master"}
if [ "$branch" != "$currBranch" ]; then
git checkout "$branch";
git fetch --prune
git pull "$remote" "$branch";
echo ""
echo "pulled from $remote $branch"
echo ""
git checkout "$currBranch";
git rebase "$branch"
echo ""
echo "rebased $branch to $currBranch"
else
echo "already on the same branch, pulling from $2"
git pull "$remote" "$branch";
fi
else
echo "not a git repository"
fi;
}
# aliases for interchangeable characters of 2 functions above
alias gbp=gpb
alias gbpr=gpbr
# docker aliases
alias dcu='docker-compose up -d'
alias dce='docker-compose exec'
alias dcr='docker-compose run --rm'
alias dc='docker-compose'
# other aliases
alias gitex=gitex.cmd
alias gx=gitex
alias rebash='source ~/.bash_profile'
alias refresh='source ~/.bash_profile'