I'm absolutely terrible with .bat files, but sometimes they are just needed. Right now I'm working on a project with quite some submodules, which have quite some submodules, and sometimes even those have submodules. Now, being a lazy programmer I figured I'd automate the task of committing the submodule-update in every single parent, and then having to push those parents manually. So I created this script:@echo offfor /f delims= %%i in ('git rev-parse --show-toplevel') do set toplevel=%%icd %toplevel%for /f delims= %%i in ('basename %cd%') do set reponame=%%iecho Master repo is %cd%git remote | xargs -L1 git push --all:intorepofor %%* in (.) do set submodulename=%%~nx*for %%* in (.) do set submoduledir=%cd%cd ..set result=falsefor /f delims= %%i in ('git rev-parse --is-inside-work-tree') do set result=%%iif %result%==true (    echo %cd% is a parent    echo %submodulename% is the submodule    git reset    git add %submodulename%    git commit -m %submodulename% has been updated, committing recursively    goto :intorepo)echo No more parentscd %submoduledir%for /f delims= %%i in ('git remote get-url origin') do set pushto=%%iecho Pushing top-most repository, and submodules on demand.git remote | xargs -L1 git push --all --recurse-submodules=on-demandecho doneAre there any improvements I could make?
Automatically push git submodule's parents recursively
git;batch