-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathg.sh
executable file
·45 lines (35 loc) · 848 Bytes
/
g.sh
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
#!/bin/bash
_g () {
branch=$(git rev-parse --abbrev-ref HEAD)
arg=$1
if [ "$arg" = "p" ]; then
p="git push -u origin $branch"
eval $p
elif [ "$arg" = "c" ]; then
msg=$2
if [ "$msg" ]; then
cmd="git add --all && git commit -m '$msg'"
eval $cmd
else
echo "Please provide a commit message"
fi
elif [ "$arg" = "l" ]; then
p="git pull origin $branch"
eval $p
elif [ "$arg" = "sync" ]; then
p="git fetch origin && git reset origin/$branch --hard"
eval $p
elif [ "$arg" = "wip" ]; then
p="git add --all && git commit -m 'WIP' && g p"
eval $p
elif [ "$arg" = "update" ]; then
msg=$(git log -1 --pretty=%B);
commit="git add --all && git commit --amend -m '$msg'"
eval $commit;
push=$(git push -u origin $branch -f)
eval $push;
else
echo 'wow not found'
fi
}
alias ${_Z_CMD:-g}='_g 2>&1'