# Check if a commit message was provided | |
if [ $# -eq 0 ]; then | |
echo "Error: Please provide a commit message" | |
echo "Usage: ./git_push.sh \"Your commit message\"" | |
exit 1 | |
fi | |
# Store the commit message | |
commit_message="$1" | |
# Echo and execute git add | |
echo "➡️ Adding all files..." | |
git add . | |
# Echo and show status | |
echo -e "\n📋 Current git status:" | |
git status | |
# Echo and commit with provided message | |
echo -e "\n💾 Committing changes with message: '$commit_message'" | |
git commit -m "$commit_message" | |
# Echo and push to main | |
echo -e "\n⬆️ Pushing to main branch..." | |
git push origin main | |
echo -e "\n✅ Done!" | |