Skip to content

Instantly share code, notes, and snippets.

@samuelastech
Created September 5, 2022 14:48
Show Gist options
  • Save samuelastech/e62396e6b7e322c4787d683653881668 to your computer and use it in GitHub Desktop.
Save samuelastech/e62396e6b7e322c4787d683653881668 to your computer and use it in GitHub Desktop.
Automated git add, commit, and push
#!/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