git 批量clone,pull 项目

1,clone脚本 clone.sh

#!/bin/bash

# 定义一个包含多个仓库URL的列表
repos=(
    "git@gitlab.test.com.cn:test/test/test/test.git"
    "git@gitlab.test.com.cn:test/test/test/test2.git"
)

# 遍历数组中的每个URL,并执行 git clone
for repo in "${repos[@]}"
do
  git clone "$repo"
done

2,运行sh脚本 ./clone.sh

3,Windows 系统
需要批量拉取代码的git仓库都在 同一个文件夹下 ,bat脚本也在此文件夹下。
此脚本递归遍历当前路径下的文件夹,直到找到存在 .git 文件的文件夹,然后执行 git pull,然后继续遍历

创建一个bat文件git_pull_batch.bat

@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 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 %%i
        echo Start git pull.
        git pull
    ) else (
        call :find_and_pull %%i
    )
)
goto :EOF

相关推荐

  1. git 批量clone,pull 项目

    2024-03-15 01:00:02       18 阅读
  2. Git批量删除本地分支

    2024-03-15 01:00:02       36 阅读
  3. git项目管理

    2024-03-15 01:00:02       30 阅读
  4. git命令-项目使用

    2024-03-15 01:00:02       21 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-03-15 01:00:02       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-15 01:00:02       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-15 01:00:02       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-15 01:00:02       18 阅读

热门阅读

  1. python--运算符和字符串

    2024-03-15 01:00:02       22 阅读
  2. SpringBoot如何修改pom依赖的默认版本号

    2024-03-15 01:00:02       18 阅读
  3. vue3中子级页面绑定调用父级页面得自定义事件

    2024-03-15 01:00:02       18 阅读
  4. 力扣爆刷第95天之hot100五连刷61-65

    2024-03-15 01:00:02       15 阅读
  5. sql语句

    2024-03-15 01:00:02       16 阅读
  6. 零基础入门多媒体音频(1)-音频基础

    2024-03-15 01:00:02       19 阅读
  7. go的slice学习

    2024-03-15 01:00:02       20 阅读
  8. 分布式锁解决方案

    2024-03-15 01:00:02       21 阅读
  9. Easy Conan + CMake template for C++ projects

    2024-03-15 01:00:02       19 阅读
  10. MFC 实现延时,并且进行消息分发,不阻塞

    2024-03-15 01:00:02       21 阅读