Last active
November 27, 2023 10:34
-
-
Save janglapuk/2e84fbc6faa5dda486ecdb2f45fccc23 to your computer and use it in GitHub Desktop.
Revisions
-
janglapuk revised this gist
Nov 27, 2023 . 1 changed file with 10 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,8 +5,9 @@ git archive --output=archive.zip HEAD ## Archive HEAD with directory prefix (like github ZIP archive) ```bash git archive --output=archive.zip --prefix=main/ HEAD ``` Important: prefix should have a trailing slash ## Archive changes between two commits (bash) ```bash @@ -22,5 +23,12 @@ git archive --output=archive.zip HEAD -- $(Get-Content changes.txt) ## Archive HEAD with excluded file/directory from `.gitignore` (e.g. `.env`, `vendor`, `node_modules`, etc.) ```bash git archive --output=archive.zip HEAD 7z a archive.zip vendor ``` If `--prefix` is set, then you need to rename (`7z rn`) the directory to place inside prefix directory ```bash git archive --output=archive.zip --prefix=main/ HEAD 7z a archive.zip vendor 7z rn archive.zip vendor main/vendor ``` -
janglapuk revised this gist
Nov 27, 2023 . 2 changed files with 26 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ ## Archive HEAD ```bash git archive --output=archive.zip HEAD ``` ## Archive HEAD with directory prefix (like github ZIP archive) ```bash git archive --output=archive.zip --prefix=main HEAD ``` ## Archive changes between two commits (bash) ```bash git archive --output=archive.zip HEAD $(git diff --name-only commit_ID_A commit_ID_B) ``` ## Archive changes between two commits (PowerShell) ```powershell git diff --name-only commit_ID_A commit_ID_B | Out-File -Encoding ASCII changes.txt git archive --output=archive.zip HEAD -- $(Get-Content changes.txt) ``` ## Archive HEAD with excluded file/directory from `.gitignore` (e.g. `.env`, `vendor`, `node_modules`, etc.) ```bash git archive --output=archive.zip HEAD 7z a -r archive.zip vendor ``` -
janglapuk created this gist
Nov 27, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ # archive HEAD git archive --output=archive.zip HEAD # archive HEAD with directory prefix (like github ZIP archive) git archive --output=archive.zip --prefix=main HEAD # archive changes between two commits (bash) git archive --output=archive.zip HEAD $(git diff --name-only commit_ID_A commit_ID_B) # archive changes between two commits (PowerShell) git diff --name-only commit_ID_A commit_ID_B | Out-File -Encoding ASCII changes.txt git archive --output=archive.zip HEAD -- $(Get-Content changes.txt) # archive HEAD with excluded file/directory from .gitignore (e.g. .env, vendor, node_modules, etc.) git archive --output=archive.zip HEAD 7z a -r archive.zip vendor