当前位置:   article > 正文

批量拉取更新多个Git仓库 bat脚本实现_windows 脚本拉取git

windows 脚本拉取git

运行前注意

  • 你使用的是 Windows 系统
  • 你需要批量拉取代码的git仓库都在 同一个文件夹下 ,bat脚本也在此文件夹下。
  • 此脚本递归遍历当前路径下的文件夹,直到找到存在 .git 文件的文件夹,然后执行 git pull,然后继续遍历…
  1. @echo off
  2. setlocal
  3. @REM normalize the relative path to a shorter absolute path.
  4. pushd "%~dp0"
  5. set repos_path=%CD%
  6. popd
  7. call :find_and_pull %repos_path%
  8. echo. & echo Finished. & pause>nul
  9. goto :EOF
  10. ::-------------------------------------
  11. :: @name find_and_pull
  12. :: @param %1 base directory to find .git
  13. :: @usage call :find_and_pull %base_dir%
  14. ::-------------------------------------
  15. :find_and_pull
  16. for /d %%i in (%1\*) do (
  17. cd %%i
  18. if exist .git (
  19. echo. & echo [ START git pull FROM ] %%i
  20. git pull
  21. ) else (
  22. call :find_and_pull %%i
  23. )
  24. )
  25. goto :EOF

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/464279
推荐阅读
相关标签
  

闽ICP备14008679号