Skip to main content

my-git-push-script-in-bash

My git push script in BASH

  • This is my daily common bash script easy to commit and push changes to the repo easily.
  • I run this script in m.sh or main.sh file if pushing main.
git add .
git commit

echo ""
echo "Press 'y' to push to origin main."
echo "Press any other key to exit."

read -n 1 -s push_choice
echo ""

if [[ $push_choice == "y" || $push_choice == "Y" ]]; then
git push origin main
else
echo "❌ Exiting without git push."
fi