83 lines
1.9 KiB
Batchfile
83 lines
1.9 KiB
Batchfile
|
@echo off
|
|||
|
|
|||
|
REM 1. <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD>ٻ<EFBFBD><D9BB><EFBFBD><EFBFBD>ĵ<DEB8><C4B5>ļ<EFBFBD>
|
|||
|
echo <20><><EFBFBD>ڻ<EFBFBD>ȡδ<C8A1><CEB4><EFBFBD>ٻ<EFBFBD><D9BB>ĵ<DEB8><C4B5>ļ<EFBFBD>...
|
|||
|
setlocal enabledelayedexpansion
|
|||
|
|
|||
|
REM <20><><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD>
|
|||
|
set "modified_files="
|
|||
|
set "untracked_files="
|
|||
|
|
|||
|
REM <20>ռ<EFBFBD><D5BC>ĵ<DEB8><C4B5>ļ<EFBFBD>
|
|||
|
for /f "tokens=*" %%i in ('git ls-files --modified') do (
|
|||
|
echo <20>ĵ<DEB8><C4B5>ļ<EFBFBD>: %%i
|
|||
|
set "modified_files=!modified_files! %%i"
|
|||
|
)
|
|||
|
|
|||
|
REM <20>ռ<EFBFBD>δ<EFBFBD><CEB4><EFBFBD>ٵ<EFBFBD><D9B5>ļ<EFBFBD>
|
|||
|
for /f "tokens=*" %%i in ('git ls-files --others --exclude-standard') do (
|
|||
|
echo δ<><CEB4><EFBFBD>ٵ<EFBFBD><D9B5>ļ<EFBFBD>: %%i
|
|||
|
set "untracked_files=!untracked_files! %%i"
|
|||
|
)
|
|||
|
|
|||
|
REM 2. <20><>ȡ<EFBFBD><C8A1>ǰ Git <20>û<EFBFBD><C3BB><EFBFBD>
|
|||
|
for /f "tokens=*" %%u in ('git config user.name') do set "username=%%u"
|
|||
|
echo <20><>ǰ Git <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>: %username%
|
|||
|
|
|||
|
REM 3. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD>洢<EFBFBD>ļ<EFBFBD>
|
|||
|
set "invalid_files="
|
|||
|
set "valid_files="
|
|||
|
|
|||
|
REM 4. <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>
|
|||
|
echo <20><><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7>...
|
|||
|
for %%f in (!modified_files! !untracked_files!) do (
|
|||
|
echo %%f | findstr /i "Content/PrivateCommonLiberal/%username%" >nul
|
|||
|
if errorlevel 1 (
|
|||
|
echo <20>ļ<EFBFBD>δͨ<CEB4><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %%f
|
|||
|
set "invalid_files=!invalid_files! %%f"
|
|||
|
) else (
|
|||
|
echo <20>ļ<EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %%f
|
|||
|
set "valid_files=!valid_files! %%f"
|
|||
|
)
|
|||
|
)
|
|||
|
|
|||
|
REM 5. <20><><EFBFBD><EFBFBD>δͨ<CEB4><CDA8><EFBFBD>ļ<EFBFBD><C4BC>б<EFBFBD>
|
|||
|
if not "!invalid_files!"=="" (
|
|||
|
echo <20><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飺
|
|||
|
for %%f in (!invalid_files!) do echo %%f
|
|||
|
|
|||
|
echo.
|
|||
|
set /p "confirm=<3D>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB>(y/n): "
|
|||
|
if /i "!confirm!"=="y" (
|
|||
|
echo <20><><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD>δͨ<CEB4><CDA8><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>...
|
|||
|
for %%f in (!invalid_files!) do (
|
|||
|
git reset "%%f" >nul 2>&1
|
|||
|
git checkout -- "%%f" >nul 2>&1
|
|||
|
git clean -f "%%f" >nul 2>&1
|
|||
|
)
|
|||
|
) else (
|
|||
|
echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
pause
|
|||
|
exit /b 1
|
|||
|
)
|
|||
|
)
|
|||
|
|
|||
|
REM 6. <20><><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB>Ϣ
|
|||
|
echo <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><D7BC><EFBFBD>ύ...
|
|||
|
set /p "title=<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD>⣺"
|
|||
|
set /p "details=<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύϸ<E1BDBB>ڣ<EFBFBD>"
|
|||
|
|
|||
|
REM 7. <20>ύͨ<E1BDBB><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|||
|
for %%f in (!valid_files!) do (
|
|||
|
git add "%%f"
|
|||
|
)
|
|||
|
git commit -m "%title%" -m "%details%"
|
|||
|
if %errorlevel% neq 0 (
|
|||
|
echo <20><><EFBFBD><EFBFBD>: <20>ύʧ<E1BDBB>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>и<EFBFBD><D0B8>ġ<EFBFBD>
|
|||
|
pause
|
|||
|
exit /b 1
|
|||
|
)
|
|||
|
|
|||
|
echo <20>ύ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>
|
|||
|
pause
|