gpt4 book ai didi

git - 在 git repos 的所有子目录中运行 "git gc"的 Powershell 命令

转载 作者:太空狗 更新时间:2023-10-29 14:43:47 28 4
gpt4 key购买 nike

我不懂任何 PowerShell,但我知道如何搜索、复制和粘贴。我认为以下命令将为 git repos 的所有子目录运行“git gc”。

dir -recurse -include .git | %{ git -C "$_.FullName\.." gc }

有什么问题吗?

我正在使用“git -C”功能来设置要在其中运行的目录。如何改为在特定目录中执行命令?

最佳答案

% { Set-Location $_.FullName; git gc }

% { Start-Process git -WorkingDirectory $_.FullName -ArgumentList gc -NoNewWindow -Wait}

第一个变体将更改您当前的工作目录,因此请注意这一点。

关于git - 在 git repos 的所有子目录中运行 "git gc"的 Powershell 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40832915/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com