简体   繁体   English

git通过Windows批处理文件更新子模块

[英]git update submodule via windows batch file

I wrote a small batch file which updates the git submodules. 我写了一个小的批处理文件来更新git子模块。 My only problem is I want to review the changes after the git command but the command window closes - even if I add the "pause" command to it. 我唯一的问题是我想在git命令之后查看更改,但命令窗口关闭-即使我向其中添加了“ pause”命令。 See: 看到:

@echo off
git submodule foreach git pull origin master
pause

When I replace the whole git command with a simple cd .. it'll work as expected (waits for the user to hit enter) so my guess is that the git command does something I don't understand right now. 当我将整个git命令替换为简单的cd ..它将按预期工作(等待用户按Enter键),所以我的猜测是git命令执行了我现在不了解的操作。

Thanks in advance! 提前致谢! krnl krnl

if the git command is a Batch file (git.bat) you must run it via a CALL command: 如果git命令是批处理文件(git.bat),则必须通过CALL命令运行它:

call git submodule foreach ....

Otherwise the original Batch file ends when the git.bat Batch file ends. 否则,当git.bat批处理文件结束时,原始批处理文件将结束。 The CALL command cause that when git.bat ends, the execution continue at the line after the CALL CALL命令导致git.bat结束时,在CALL之后的行继续执行

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

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