Skip to content

Instantly share code, notes, and snippets.

@AndreLouisCaron
Created April 18, 2012 15:44
Show Gist options
  • Save AndreLouisCaron/2414445 to your computer and use it in GitHub Desktop.
Save AndreLouisCaron/2414445 to your computer and use it in GitHub Desktop.
git-archive-all for Windows
@echo off
git-ls-all-submodules | zip -@ ../source-code.zip
@echo off
rem -- Make sure 'submodules.bat' is still resolved correctly after 'pushd'.
set Path=%~dp0;%Path%
rem -- Launch from the location of this script.
set root=%~dp0
call:explore %root:~0,-1%
exit /b 0
:explore
rem -- List all files in the current repository.
for /f "usebackq delims=" %%p in (
`git ls-files --cached --full-name --no-empty-directory`
) do (
echo %~1/%%p
)
rem -- Recurse into sub-modules.
for /f "usebackq delims=" %%p in (`submodules`) do (
pushd "%%p"
call:explore %%p
popd
)
exit /b 0
@echo off
setlocal EnableDelayedExpansion
for /f "usebackq delims=" %%p in (
`call git submodule --quiet foreach 'pwd'`
) do (
set base=%%p & echo C:/!base:~3!
)
exit /b 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment