Dump a Git Revision into a Folder
Feels almost silly to write this one out, but hey, it was a note I took
and I figure writing it out helps me remember. I wanted to have all the
files of a certain Git revision (think a specific commit, a branch, or
a tag) available in a different folder. I could not be bothered with
various stashing, checking out, and the like. In comes git archive
.
git archive SOMEREVISION | tar -x -C /some/target/folder
git archive
takes a revision and outputs a tarball to STDOUT- pipe it to
tar
tar -x
extracts-C folder
changes into that folder before extracting