Created
May 7, 2021 12:52
-
-
Save lablnet/c97d68f7668dfa96376dd1a6224c09a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage ./git.sh "commit msg" branch | |
if [ -z "$1" ]; then | |
echo "Please provide commit message." | |
exit | |
fi | |
# we can pull before commit or push | |
# check if branch is provide, if not make push it to default. | |
if [ -z "$2" ]; then | |
git pull | |
else | |
git pull origin $2 | |
fi | |
# add files, commit and push changes. | |
git add -A | |
git commit -m "$1" | |
# check if branch is provide, if not make push it to default. | |
if [ -z "$2" ]; then | |
git push | |
else | |
git push origin $2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment