windows - 运行 git pull 所有子目录窗口命令提示符

标签 windows git command-prompt

如何在不进入 Windows 7 上每个存储库的根目录的情况下从共享父目录更新多个 git 存储库?

我有以下所有独立的 git 存储库(不是子模块):

c:\projects\repos\repo1
c:\projects\repos\repo2
c:\projects\repos\repo3

在 linux 上我可以使用这个 bash 脚本

find ~/projects/repos/ -type d -name .git \
| xargs -n 1 dirname \
| sort \
| while read line; do echo $line && cd $line && git pull origin $1 && echo ; done

最佳答案

Windows 批处理解决方案:

如果您想在 .bat 脚本中使用它,请使用:

for /D %%G in ("*") do (echo %%G) && (cd %%G) && (git pull origin) && (cd ..)

如果它只是在控制台中:

for /D %G in ("*") do (echo %G) && (cd %G) && (git pull origin) && (cd ..)

关于windows - 运行 git pull 所有子目录窗口命令提示符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26526252/

相关文章:

windows - 在 Windows 下使用 GIT with/SSH key 文件的问题

javac 不是内部或外部命令,也不是可运行的程序或批处理文件

c++ - 无法加载 64 位 dll

git:致命:无法从远程存储库读取

windows - ssh : Could not resolve hostname github. com + STATUS_ACCESS_VIOLATION 在 eip=68086014

git - 维护不包含与特定更改相关的提交的分支

python - 保存一系列命令并将其重新加载到 Python shell 中

java - 将命令调用添加到 Unix 命令行应用程序

python - winpexpect 的行为不像 pexpect

linux - 如何在 Windows 主机上的 Vagrant 中以区分大小写的方式处理文件