31 lines
885 B
Bash
Executable File
31 lines
885 B
Bash
Executable File
#!/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@gitea.zuev.company: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 |