Skip to content

Instantly share code, notes, and snippets.

@hereswhatidid
Last active November 25, 2022 03:55
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save hereswhatidid/8876881 to your computer and use it in GitHub Desktop.
Save hereswhatidid/8876881 to your computer and use it in GitHub Desktop.
Create a zip archive of a specific commit. The archive will be named deploy/deploy-COMMITID.zip.
setlocal enabledelayedexpansion
set var=%1
set output=
for /f "delims=" %%a in ('git diff-tree --no-commit-id --name-only -r %1^^') do ( set output=!output! "%%a" )
git archive -o update-%var:~0,7%.zip HEAD %output%
endlocal
#!/bin/sh
args=("$@")
git archive -o deploy/deploy-${args[1]:0:7}.zip HEAD $(git diff-tree --no-commit-id --name-only -r ${args[1]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment