Created
September 5, 2022 14:48
-
-
Save samuelastech/e62396e6b7e322c4787d683653881668 to your computer and use it in GitHub Desktop.
Automated git add, commit, and push
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 | |
FINISHED=false | |
while ! $FINISHED; do | |
echo 'Enter the files you want to commit: ' | |
read FILES | |
if [ $FILES == '.' ]; then | |
git add $FILES | |
FINISHED=true | |
else | |
git add $FILES | |
echo 'Add more? (y/n): ' | |
read ANSWER | |
if [ $ANSWER = 'n' ]; then | |
FINISHED=true | |
fi | |
clear | |
fi | |
done | |
clear | |
echo 'Enter the commit message:' | |
read COMMIT_MESSAGE | |
git commit -m "$COMMIT_MESSAGE" | |
echo 'Enter the name of the branch:' | |
read BRANCH | |
git pull origin $BRANCH | |
git push origin $BRANCH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment