69 lines
1.5 KiB
Batchfile
69 lines
1.5 KiB
Batchfile
@echo off
|
|
REM Script de sincronização automática com GitHub
|
|
REM Uso: sync.bat [mensagem do commit]
|
|
|
|
echo ========================================
|
|
echo TrackSteel - Sync com GitHub
|
|
echo ========================================
|
|
echo.
|
|
|
|
REM Verifica se há mudanças para commitar
|
|
git status --porcelain > nul
|
|
if %errorlevel% neq 0 (
|
|
echo Erro ao verificar status do Git
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
REM Adiciona todos os arquivos
|
|
echo Adicionando arquivos...
|
|
git add .
|
|
if %errorlevel% neq 0 (
|
|
echo Erro ao adicionar arquivos
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
REM Define mensagem do commit
|
|
if "%~1"=="" (
|
|
set "commit_msg=Update: %date% %time%"
|
|
) else (
|
|
set "commit_msg=%~1"
|
|
)
|
|
|
|
echo Fazendo commit com mensagem: %commit_msg%
|
|
git commit -m "%commit_msg%"
|
|
if %errorlevel% neq 0 (
|
|
echo Nenhuma mudança para commitar ou erro no commit
|
|
echo.
|
|
echo Status atual:
|
|
git status
|
|
pause
|
|
exit /b 0
|
|
)
|
|
|
|
REM Push para o repositório
|
|
echo Enviando para GitHub...
|
|
git push origin main
|
|
if %errorlevel% neq 0 (
|
|
echo Erro ao fazer push. Tentando pull primeiro...
|
|
git pull origin main --rebase
|
|
if %errorlevel% neq 0 (
|
|
echo Erro no pull. Resolva conflitos manualmente.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo Tentando push novamente...
|
|
git push origin main
|
|
if %errorlevel% neq 0 (
|
|
echo Erro no push após pull
|
|
pause
|
|
exit /b 1
|
|
)
|
|
)
|
|
|
|
echo.
|
|
echo ✓ Sincronização concluída com sucesso!
|
|
echo ✓ Mudanças enviadas para: https://github.com/Reifonas/WebsiteTS.git
|
|
echo.
|
|
pause |