侧边栏壁纸
  • 累计撰写 1,975 篇文章
  • 累计创建 73 个标签
  • 累计收到 20 条评论

目 录CONTENT

文章目录

Git批量拉取更新所有项目

猿哥
2023-03-31 / 0 评论 / 0 点赞 / 211 阅读 / 121 字

Git批量拉取更新所有项目

" "

需求描述

一键批量拉取更新所有的git仓

解决方式

通过windows批处理bat脚本实现

chcp 65001
@echo off
setlocal

@REM normalize the relative path to a shorter absolute path.
pushd "%~dp0"
set repos_path=%CD%
popd

call :find_and_pull %repos_path%
echo. & echo Finished. & pause>nul
goto :EOF

::-------------------------------------
:: @name   find_and_pull
:: @param  %1 base directory to find .git
:: @usage  call :find_and_pull %base_dir%
::-------------------------------------
:find_and_pull
for /d %%i in (%1\*) do (
    cd %%i
    if exist .git (
        echo. & echo [ START git pull FROM ] %%i
        git pull
    ) else (
        call :find_and_pull %%i
    )
)
goto :EOF

0
博主关闭了所有页面的评论