-
Notifications
You must be signed in to change notification settings - Fork 0
/
git_add_push.sh
executable file
·66 lines (52 loc) · 953 Bytes
/
git_add_push.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/zsh
# TODO
# - error check on arg1
# - include built in arry of directories to ALWAYS run.
# - if arg1 is "." (current dir) expand to FULL PATH
#
#
# PURPOSE: Automate git add, git push for given REPO.
# USAGE:
# - for specified directory, performs git push
#
# define function
#
# returns true or false
has_arg() {
test -n "$1"
}
#
add_commit_push()
{
if has_arg "$1"
then
else echo "** problem ** "
echo "USAGE: must have arg <dir>"
exit
fi
cd $1
# Add files, Commit, Push
line="---------------------------"
echo "\n"
echo $line
echo $(date)
echo "BEGIN ...... ${1} ... ${PWD}"
#echo "\n"
echo "STATUS ......\n"
git s
echo "\n"
echo "ADD FILES ......"
git a
#echo "\n"
echo "COMMIT ......"
git cm wip
#echo "\n"
echo "PUSH ......"
git push
echo "\n"
echo "FINAL STATUS ......"
git s
echo $line
}
# run function, using directory specified as arg 1
add_commit_push $1