-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_git_cmd
58 lines (55 loc) · 1.63 KB
/
.bash_git_cmd
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
#!bash
gunpushed() {
local branch remote tracking rbranch
branch=`git symbolic-ref -q HEAD`
if [ -n "$branch" ]; then
branch="${branch##refs/heads/}"
remote=`git config branch.${branch}.remote`
tracking=`git config branch.${branch}.merge`
if [ -n "$remote" -a -n "$tracking" ]; then
tracking="${tracking##refs/heads/}"
rbranch="$remote/$tracking"
echo "UNPUSHED: git log $rbranch..$branch"
git log $rbranch..$branch
echo "UNPULLED: git log $branch..$rbranch"
git log $branch..$rbranch
fi
fi
}
gpu() {
local branch remote tracking
branch=`git symbolic-ref -q HEAD`
if [ -n "$branch" ]; then
branch="${branch##refs/heads/}"
remote=`git config branch.${branch}.remote`
tracking=`git config branch.${branch}.merge`
if [ -n "$remote" -a -n "$tracking" ]; then
tracking="${tracking##refs/heads/}"
echo "git push $remote $tracking"
git push $remote $tracking
else
echo "** creating new remote branch $branch **"
echo "git push -u origin $branch"
git push -u origin $branch
fi
fi
}
gpforce() {
local branch remote tracking
branch=`git symbolic-ref -q HEAD`
local branch remote tracking
branch=`git symbolic-ref -q HEAD`
if [ -n "$branch" ]; then
branch="${branch##refs/heads/}"
remote=`git config branch.${branch}.remote`
tracking=`git config branch.${branch}.merge`
if [ -n "$remote" -a -n "$tracking" ]; then
tracking="${tracking##refs/heads/}"
echo "git push --force $remote $tracking"
git push --force $remote $tracking
else
echo "Branch does not exist"
exit 1
fi
fi
}