Files
magistr/.agent/skills/git-push/scripts/push_changes.sh

31 lines
879 B
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
COMMIT_MSG="$1"
# Проверка: если сообщение пустое, ругаемся
if [ -z "$COMMIT_MSG" ]; then
echo "❌ Error: Commit message is required."
echo "Usage: ./push_changes.sh \"feat: description\""
exit 1
fi
echo "🚀 Starting Local Push Sequence..."
# Проверка на наличие изменений
if git diff-index --quiet HEAD --; then
echo " No changes to commit. Everything is up to date."
exit 0
fi
# Выполняем цепочку команд локально (SSH URL: ssh://git@192.168.1.87:2222/Zuev/magistr.git)
git add . && \
git commit -m "$COMMIT_MSG" && \
git push origin main
# Проверяем код возврата
if [ $? -eq 0 ]; then
echo "✅ Success! Changes pushed to remote."
else
echo "❌ Failed to push. Check the output above for errors."
exit 1
fi