繁体   English   中英

如何为文件夹中的所有子目录执行 git 拉取?(在 Windows 中)

[英]How to do git pull for all sub-directories in a folder?(In Windows )

I have a git directory, I want to do git pull for all sub directories, sub sub directory and so on, how to do that in windows command prompt or powershell?

NOTE : I know about similar questions, but none of them work for me as some are for linux and rest only do git pull for .git folders inside master folder(ie depth = 1 ), I want depth = ∞

试试这个:

for /r %a in (.) do @if exist "%a/.git" cmd /c "cd /d %a && git pull"

它递归地遍历所有子目录,并检查它是否包含.git目录,如果是,它在这个找到的路径中运行命令

早上好!

在 powershell 中,递归子目录就像提供-recurse参数一样简单。 例如:

Get-ChildItem -Path C:\Users\me -Filter "*.git" -Recurse

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM