diff --git a/git-pull-all.bat b/git-pull-all.bat index 8a44c25..d0a4735 100644 --- a/git-pull-all.bat +++ b/git-pull-all.bat @@ -34,24 +34,19 @@ echo; @REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd ) for /d %%o in (*) do ( - @REM echo "%%o" | findstr "node_modules" >NUL && ( - @REM echo !!!!!!!! omitting [%FONPATH%\%%o] !!!!!!!! - @REM echo; - @REM ) || ( - echo ======== entering [%FONPATH%\%%o] ======== - echo; - pushd %%o - for /d %%g in (*) do ( - if exist "%%g\.git" ( - pushd %%g - echo ---- git pulling [%FONPATH%\%%o\%%g] ---- - git pull --all - echo; - popd - ) + echo ======== entering [%FONPATH%\%%o] ======== + echo; + pushd %%o + for /d %%g in (*) do ( + if exist "%%g\.git" ( + pushd %%g + echo ---- git pulling [%FONPATH%\%%o\%%g] ---- + git pull --all + echo; + popd ) - popd - @REM ) + ) + popd ) popd diff --git a/git-pull-recursive.bat b/git-pull-recursive.bat index 9446aaa..d7eb41e 100644 --- a/git-pull-recursive.bat +++ b/git-pull-recursive.bat @@ -32,7 +32,7 @@ echo *** Starting from [%CD%] *** echo; for /d /r %%r in (*) do ( - echo "%%r" | findstr "node_modules" >NUL || ( + echo "%%r" | findstr "node_modules" >NUL && ( echo; ) || ( if exist "%%r\.git" ( pushd "%%r" echo ---- git pulling [%%r] ---- diff --git a/git-push-all.bat b/git-push-all.bat index fd26ef9..82a7043 100644 --- a/git-push-all.bat +++ b/git-push-all.bat @@ -31,7 +31,7 @@ pushd %FONPATH% echo *** Starting from [%CD%] *** echo; -echo === Enter [commit message] or leave blank for default to 'updated' +echo === Enter [commit message] or [leave blank] for default to 'updated' set /p COMMIT_MESSAGE=">>> " @ if "" == "%COMMIT_MESSAGE%" ( set COMMIT_MESSAGE="updated" @@ -41,24 +41,19 @@ echo; @REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd ) for /d %%o in (*) do ( - @REM echo "%%o" | findstr "node_modules" >NUL && ( - @REM echo !!!!!!!! omitting [%FONPATH%\%%o] !!!!!!!! - @REM echo; - @REM ) || ( - echo ======== entering [%FONPATH%\%%o] ======== - echo; - pushd %%o - for /d %%g in (*) do ( - if exist %%g\.git ( - pushd %%g - echo ---- git commit and push [%FONPATH%\%%o\%%g] ---- - git add . && git commit -m "%COMMIT_MESSAGE%" && git push - echo; - popd - ) + echo ======== entering [%FONPATH%\%%o] ======== + echo; + pushd "%%o" + for /d %%g in (*) do ( + if exist %%g\.git ( + pushd "%%g" + echo ---- git commit and push [%FONPATH%\%%o\%%g] ---- + git add . && git commit -m "%COMMIT_MESSAGE%" && git push + echo; + popd ) - popd - @REM ) + ) + popd ) popd diff --git a/git-push-recursive.bat b/git-push-recursive.bat new file mode 100644 index 0000000..dec2f54 --- /dev/null +++ b/git-push-recursive.bat @@ -0,0 +1,59 @@ +@echo off + +@REM 首先清除可能残留的变量 +set FONPATH= + +@ if not "" == "%1" ( + set FONPATH=%1 +) else ( + if exist D:\faronear ( + set FONPATH=D:\faronear + ) else (if exist C:\faronear ( + set FONPATH=C:\faronear + ) else (if exist %HOMEDRIVE%%HOMEPATH%\faronear ( + set FONPATH=%HOMEDRIVE%%HOMEPATH%\faronear + ) else ( + echo === Enter [target path] or leave [blank] for default to `.` + set /p FONPATH=">>> " + echo; + if "" == "%FONPATH%" ( + set FONPATH=. + ) + ))) +) + +if not exist "%FONPATH%" ( + echo *** [%FONPATH%] not exist! Exit now. *** + @ GOTO END +) + +pushd %FONPATH% +echo *** Starting from [%CD%] *** +echo; + +echo === Enter [commit message] or [leave blank] for default to 'updated' +set /p COMMIT_MESSAGE=">>> " +@ if "" == "%COMMIT_MESSAGE%" ( + set COMMIT_MESSAGE="updated" +) +echo; + +for /d /r %%r in (*) do ( + echo "%%r" | findstr "node_modules" >NUL && ( echo; ) || ( + if exist "%%r\.git" ( + pushd "%%r" + echo ---- git commit and push [%%r] ---- + git add . && git commit -m "%COMMIT_MESSAGE%" && git push + echo; + popd + ) + ) +) + + +popd + +:END + +pause +