-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitty.sh
executable file
·38 lines (34 loc) · 1.27 KB
/
gitty.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
#!/bin/bash
# Committing made easy
# Working with origin remote repository and master branch
# ./gitty FILE_TO_COMMIT ["COMMIT_COMMENTS"]
# (c) Mohammad Hasanzadeh Mofrad, 2019
# (e) [email protected]
# To setup under a Linux box after git clone REPO_ADDRESS
# git config --local user.email EMAIL
# git config --global user.email EMAIL
# sudo git config --system user.email EMAIL
# git config --local user.name NAME
# git config --global user.name NAME
# sudo git config --system user.name NAME
if [ -z "$1" ] || [ $# -gt 2 ]; then
echo "Usage: ./gitty.sh <FILE|FLAG> [\"COMMENT\"]";
echo "FLAGS (git v2.x):"
echo " . : Stage all (new, modified, deleted) files"
echo " --all : Stage all (new, modified, deleted) files"
echo " --ignored-removal .: Stage new and modified files"
echo " --update : Stage modified and deleted files"
exit 1;
fi
git config --global user.email [email protected]
git config --local user.email [email protected]
FILE=$1
COMMENT=$2
# Disable gnome-ssh-askpass
unset SSH_ASKPASS;
# File to commit
git add $FILE;
# Now commit the change
git commit -m "Update $FILE $COMMENT";
# Push the commit to master branch
git push origin master;