Reputation: 5270
This answer is for linux command line. I need the same for Windows command line. I created the following using this, but my code does not work.
for /D /r %i in (*.*) do (cd %i && echo %i && git pull && cd ..)
From @SevenEleven's answer and @kostix's comment the following worked.
for /D %%i in (.\*) do (cd "%%i" && git pull && cd..)
or
for /D %%i in (*) do (cd "%%i" & git pull && cd..)
Upvotes: 1
Views: 2665
Reputation: 2474
This should do the job:
for /D %%i in (.\*) do (cd %%i && echo %%i && git pull && cd ..)
This script searches the subdirectories of the current directory (for /D %%i in (.\*)
). It changes to every directory found (cd %%i
), writes its name to console (echo %%i
) and executes git pull
/r
does search all subdirectories too. Since you don't want to search your projects subdirectories, that is not needed. If you search an absolute path, you can get rid of the cd ..
:
Upvotes: 6