m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--git.md9
1 files changed, 9 insertions, 0 deletions
diff --git a/git.md b/git.md
index c8ae6ae..0c512d0 100644
--- a/git.md
+++ b/git.md
@@ -21,3 +21,12 @@
git diff > change.patch
patch -p1 < change.patch # -p1 to remove the a/ and b/ from filepaths
+
+## Exporting a commit
+
+ git archive <commit>
+
+Outputs to stdout a tar archive of the index at the given commit. Make a
+directory of just the code, not a repo:
+
+ git archive <commit> | tar --extract --directory <output dir>