-
Notifications
You must be signed in to change notification settings - Fork 0
/
auto-git.sh
executable file
·49 lines (45 loc) · 1.54 KB
/
auto-git.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
time=$(date)
echo $time
n=1
echo "============================Auto Git============================"
echo "|| This script is now monitoring this current directory ||"
echo "|| Enter the update interval between each push (Eg. 1 = 1 min)||"
echo "================================================================"
echo "-------------------"
read -p "Interval Time: " inter
echo "-------------------"
echo
echo
echo
echo
echo
while :
do
if [ -d .git ]; then
echo "====================================="
echo "|| This is the current Repo Status ||"
echo "====================================="
git add .
git status
echo "-----------------------------------------------------------------------------------------"
git commit -m "This commit is made by Auto-Git. Commit-$n, $time"
echo "-----------------------------------------------------------------------------------------"
git push
echo "--------------------"
echo "|| Commit $n Made ||"
echo "--------------------"
# echo "-------------------------"
# echo "|| No Changes to Commit||"
# echo "-------------------------"
# git commit -m "This commit is made by Auto-Git. Commit-$n, $time"
n=$(($n + 1));
else
echo "==================================="
echo "|| Fatal! This is Not a Git Repo ||"
echo "==================================="
git rev-parse --git-dir 2> /dev/null;
exit 1;
fi;
d=$(($inter * 60));
sleep $d;
done