-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
134 lines (107 loc) · 2.92 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
alias gs='git status'
alias gb='git branch'
alias gt='git show-branch -a'
alias ll="ls -la"
alias lg=lg2
alias lg1="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all"
alias lg2="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"
alias lg3="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 cyan)(committed: %cD)%C(reset) %C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)' --all"
#git_savePush [commit message]
function git_savePush() {
if [ -z "$1" ]
then
echo "You have to give a commit message."
else
git add .
git commit -a -m "$1"
git push
fi
}
#git_update [branch name]
#or 'git pull' looks faster on my PC
#https://www.derekgourlay.com/blog/git-when-to-merge-vs-when-to-rebase/
function git_update() {
if [ -z "$1" ]
then
echo "You have the branch name (current) to update."
else
git fetch origin
git rebase -p origin/$1
fi
}
#git_changeBranch [branch name]
function git_changeBranch() {
if [ -z "$1" ]
then
echo "You have to give the branc name where we should switch."
else
git checkout $1
fi
}
#git_createBranch [new branch name] [from branch]
function git_createBranch() {
if [ -z "$1" ]
then
echo "You have to give the new bracnh name."
else
git checkout -b $1 $2
fi
}
#git_closeFeatureBranch [cloned branch name]
function git_closeFeatureBranch_develop() {
if [ -z "$1" ]
then
echo "You have to give the cloned (current) bracnh name."
else
git pull origin develop
git checkout develop
if git merge $1
then
git push
git branch -d $1
fi
fi
}
#git_releaseBranch_master [release branch name] [annotate] [tag name]
#e.g. "release-0.1" 0.1 "Initial public release"
function git_releaseBranch_master() {
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ];
then
echo "You have to give the release branch name, the tag id and the tag name."
else
git checkout master
git merge $1
git push
git tag -a $2 -m "$3" master
git push --tags
git checkout develop
git merge $1
git push
if git merge $1
then
git branch -d $1
fi
fi
}
#git_releaseBranch_master [issue branch name]
function git_hotFix_master() {
if [ -z "$1" ]
then
echo "You have to give the issue bracnh name."
else
git checkout master
git merge $1
git push
git checkout develop
git merge $1
git push
if git merge $1
then
git branch -d $1
fi
fi
}
#edit [filename]
function edit(){
"C:\Program Files\Sublime Text 3\sublime_text.exe" $1 &
}