69 lines
1.6 KiB
Batchfile
69 lines
1.6 KiB
Batchfile
@echo off
|
|
REM Auto-commit batch script for LightRAG project
|
|
REM Usage: auto_commit.bat "Commit message"
|
|
|
|
setlocal
|
|
|
|
REM Get commit message from command line or generate one
|
|
if "%1"=="" (
|
|
for /f "tokens=1-3 delims=/: " %%a in ('time /t') do set TIME=%%a%%b
|
|
for /f "tokens=1-3 delims=/- " %%a in ('date /t') do set DATE=%%a-%%b-%%c
|
|
set MESSAGE=Auto-commit: %DATE% %TIME%
|
|
) else (
|
|
set MESSAGE=%1
|
|
)
|
|
|
|
echo Auto-commit starting with message: %MESSAGE%
|
|
echo ============================================================
|
|
|
|
REM Step 1: Check git status
|
|
echo 1. Checking git status...
|
|
git status --porcelain
|
|
if %errorlevel% neq 0 (
|
|
echo Error checking git status
|
|
exit /b 1
|
|
)
|
|
|
|
REM Step 2: Add all changes
|
|
echo.
|
|
echo 2. Adding all changes...
|
|
git add -A
|
|
if %errorlevel% neq 0 (
|
|
echo Error adding changes
|
|
exit /b 1
|
|
)
|
|
echo Changes added.
|
|
|
|
REM Step 3: Commit
|
|
echo.
|
|
echo 3. Committing with message: '%MESSAGE%'
|
|
git commit -m "%MESSAGE%"
|
|
if %errorlevel% neq 0 (
|
|
echo Error committing
|
|
exit /b 1
|
|
)
|
|
echo Commit successful.
|
|
|
|
REM Step 4: Push to remote
|
|
echo.
|
|
echo 4. Pushing to remote repository...
|
|
git push origin master
|
|
if %errorlevel% neq 0 (
|
|
echo Error pushing, trying with credentials...
|
|
git push http://jleu3482:jleu1212@localhost:8467/jleu3482/railseek6.git master
|
|
if %errorlevel% neq 0 (
|
|
echo Push failed
|
|
exit /b 1
|
|
)
|
|
)
|
|
echo Push successful!
|
|
|
|
REM Step 5: Show git log
|
|
echo.
|
|
echo 5. Latest commit:
|
|
git log --oneline -3
|
|
|
|
echo.
|
|
echo ============================================================
|
|
echo Auto-commit completed successfully!
|
|
endlocal |