Skip to content

Instantly share code, notes, and snippets.

@mcenirm
Created November 4, 2016 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcenirm/c38f6a71114c0d35454df8b0971c74c2 to your computer and use it in GitHub Desktop.
Save mcenirm/c38f6a71114c0d35454df8b0971c74c2 to your computer and use it in GitHub Desktop.
Reminder for how to git-archive when there are no branches or tags
prefix=... # eg, $( dirname "$( /bin/pwd )" )
treeish=... # eg, HEAD
version=$( TZ=UTC git log --date=format-local:%Y%m%d%H%M%S --format=%cd-%h "$treeish" )
git archive --prefix=${prefix}/ -o ${prefix}-${version}.tar.gz "$treeish"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment