Files
PromptTech/scripts/commit_local.sh

92 lines
2.1 KiB
Bash
Raw Permalink Normal View History

2026-02-18 23:00:58 -06:00
#!/bin/bash
# Local Git Commit Script
# This script commits changes to the local repository
echo "===================================="
echo "Local Git Commit Script"
echo "===================================="
echo ""
# Show current status
echo "Current Git Status:"
git status
echo ""
# Ask user for commit type
echo "Select what to commit:"
echo "1) All changes (including logs)"
echo "2) Code changes only (exclude logs)"
echo "3) Custom selection"
read -p "Enter your choice (1-3): " choice
case $choice in
1)
echo ""
echo "Adding all changes..."
git add .
;;
2)
echo ""
echo "Adding code changes (excluding logs)..."
git add frontend/public/favicon*.png
git add frontend/public/android-chrome-*.png
git add frontend/public/apple-touch-icon.png
git add frontend/public/manifest.json
git add frontend/public/favicon.ico
git add frontend/public/index.html
git add frontend/src/components/cards/ProductCard.js
git add frontend/src/pages/About.js
git add frontend/src/pages/Products.js
git add backend/create_favicons.py
git add backend/update_hero_image.py
;;
3)
echo ""
echo "Enter the files/folders to add (space-separated):"
read -p "> " files
git add $files
;;
*)
echo "Invalid choice. Exiting."
exit 1
;;
esac
echo ""
echo "Staged changes:"
git status
echo ""
# Get commit message from user
read -p "Enter commit message: " commit_message
if [ -z "$commit_message" ]; then
echo "Error: Commit message cannot be empty."
exit 1
fi
# Commit the changes
echo ""
echo "Committing changes..."
git commit -m "$commit_message"
if [ $? -eq 0 ]; then
echo ""
echo "✓ Changes committed successfully!"
echo ""
echo "Current status:"
git log -1 --oneline
echo ""
git status
else
echo ""
echo "✗ Commit failed!"
exit 1
fi
echo ""
echo "===================================="
echo "Commit completed successfully!"
echo "===================================="