This commit is contained in:
2025-10-04 02:47:23 +02:00
parent 0261d0a105
commit ce28524f8d

40
push.sh
View File

@@ -1,55 +1,55 @@
#!/bin/bash #!/bin/bash
# Script pour automatiser git add, commit et push # Script to automate git add, commit and push
# Usage: ./git-commit.sh "votre message de commit" # Usage: ./push.sh "your commit message"
# Vérifier si un message de commit a été fourni # Check if a commit message has been provided
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo "Erreur: Veuillez fournir un message de commit." echo "Error: Please provide a commit message."
echo "Usage: ./git-commit.sh \"votre message de commit\"" echo "Usage: ./push.sh \"your commit message\""
exit 1 exit 1
fi fi
# Récupérer le message de commit depuis les arguments # Get the commit message from arguments
COMMIT_MESSAGE="$1" COMMIT_MESSAGE="$1"
echo "Exécution des commandes git..." echo "Executing git commands..."
echo "----------------------------------------" echo "----------------------------------------"
# git add . # git add .
echo "1. Ajout de tous les fichiers (git add .)" echo "1. Adding all files (git add .)"
git add . git add .
# Vérifier si git add a réussi # Check if git add succeeded
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "✓ git add . - Succès" echo "✓ git add . - Success"
else else
echo "✗ git add . - Échec" echo "✗ git add . - Failed"
exit 1 exit 1
fi fi
# git commit # git commit
echo "2. Commit avec le message: \"$COMMIT_MESSAGE\"" echo "2. Committing with message: \"$COMMIT_MESSAGE\""
git commit -m "$COMMIT_MESSAGE" git commit -m "$COMMIT_MESSAGE"
# Vérifier si git commit a réussi # Check if git commit succeeded
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "✓ git commit - Succès" echo "✓ git commit - Success"
else else
echo "✗ git commit - Échec" echo "✗ git commit - Failed"
exit 1 exit 1
fi fi
# git push # git push
echo "3. Push vers le repository distant" echo "3. Pushing to remote repository"
git push git push
# Vérifier si git push a réussi # Check if git push succeeded
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "✓ git push - Succès" echo "✓ git push - Success"
echo "----------------------------------------" echo "----------------------------------------"
echo "Toutes les opérations git ont été effectuées avec succès !" echo "All git operations completed successfully!"
else else
echo "✗ git push - Échec" echo "✗ git push - Failed"
exit 1 exit 1
fi fi