Arkadiy Zamaraev Arkadiy Zamaraev - 5 months ago 17
Git Question

Run git pull over all subdirectories windows command promt

How can I update multiple git repositories from their shared parent's directory without cd'ing into each repo's root directory on windows 7 ?

I have the following which are all separate git repositories (not submodules):


On linux I can use this bash script

find ~/projects/repos/ -type d -name .git \
| xargs -n 1 dirname \
| sort \
| while read line; do echo $line && cd $line && git pull origin $1 && echo ; done


Windows Batch solution:

if you want to use this in .bat script use this:

for /D %%G in ("*") do (echo %%G) && (cd %%G) && (git pull origin) && (cd ..)

if it's just in the console:

for /D %G in ("*") do (echo %G) && (cd %G) && (git pull origin) && (cd ..)