-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgith-push
executable file
·50 lines (36 loc) · 959 Bytes
/
gith-push
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
#!/bin/bash
echo ""
echo "EasyNOMP Committing all changes/files to Git..."
echo ""
source ~/.bashrc
source /etc/os-release
## who am i? ##
SCRIPTNAME="$(readlink -f ${BASH_SOURCE[0]})"
BASEDIR="$(dirname $SCRIPTNAME)"
GITPRJDIR=$(git rev-parse --show-toplevel)
RELIN=$(realpath --relative-to="${GITPRJDIR}" "${1}")
## Okay, print it ##
echo "Script name : $SCRIPTNAME"
echo "Current working dir : $PWD"
echo "Script location path (dir) : $BASEDIR"
echo "Git repo location path (dir) : $GITPRJDIR"
echo "INPUT: ${RELIN}"
echo ""
if [ ! -z $GITPRJDIR ]; then
cd ${GITPRJDIR};
# Add to git commit
git commit -am "${1}"
echo "";
git push
echo "";
echo "";
echo "I've successfully pushed the commit with message [${1}]!";
cd ${PWD};
else
# Add to git ignore
echo "This location is not a git repo!";
fi
echo ""
echo "Done!"
echo ""
exit 0