我正在编写一个需要同时将代码推送到多个 git 存储库的 powershell 脚本?
这是我到目前为止的脚本:
param(
[parameter(Mandatory=$true)]
[string]$repoPath,
[parameter(Mandatory=$true)]
[array]$remoteRepos
)
pushd $repoPath
$remoteRepos | % {
#Want to exexcute this without blocking
& git push $_ master --fore -v
}
popd
这是我执行脚本的方式:
gitdeploy.ps1 -repoPath c:\code\myrepo -remoteRepos repo1,repo2
如何以& git push $_ master --fore -v
非阻塞方式执行?
解决方案
感谢@Jamey 的解决方案。我执行了这个命令:
Start-Process "cmd.exe" "/c git push $_ master --force -v"