简体   繁体   中英

git update submodule via windows batch file

I wrote a small batch file which updates the git submodules. 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. 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.

Thanks in advance! krnl

if the git command is a Batch file (git.bat) you must run it via a CALL command:

call git submodule foreach ....

Otherwise the original Batch file ends when the git.bat Batch file ends. The CALL command cause that when git.bat ends, the execution continue at the line after the CALL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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