-
Notifications
You must be signed in to change notification settings - Fork 71
/
push.sh
executable file
·61 lines (48 loc) · 1.3 KB
/
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
#!/bin/bash
#
# Copyright (C) 2022 Mahmoud Mohamed (Ozil) <https://github.com/mmsaeed509>
# LICENSE © GNU-GPL3
#
#
# you can run script with 2 arguments (your commit comment)
# ./push.sh -m "yourCommit"
#
# a simple script to push your commits to GitHub #
echo -e "\e[0;35m############################# \e[0m"
echo -e "\e[0;35m# Git Push Script # \e[0m"
echo -e "\e[0;35m############################# \e[0m"
# get branch name (e.g master, main, etc... ) #
Branch=$(git branch --show-current)
# get new updates if it founded #
echo ""
echo "#################"
echo "# Updating Repo #"
echo "#################"
git pull
echo ""
echo "##################################"
echo "# Adding new changes to the repo #"
echo "##################################"
git add --all .
if [ "$1" == "-m" ];
then
# commit changes#
echo ""
git commit -m "$2"
else
# read commit comment from user #
echo ""
echo "##################################"
echo "# Write your commit comment! :- #"
read yourCommit
# commit changes#
echo ""
git commit -m "$yourCommit"
fi
# push to repo #
echo ""
git push -u origin $Branch
echo ""
echo -e "\e[0;35m########################### \e[0m"
echo -e "\e[0;35m# D O N E # \e[0m"
echo -e "\e[0;35m########################### \e[0m"