Skip to content

Instantly share code, notes, and snippets.

@LeonardoCardoso
Last active October 9, 2023 22:38
Show Gist options
  • Save LeonardoCardoso/6c083b90a8c327d8c82f to your computer and use it in GitHub Desktop.
Save LeonardoCardoso/6c083b90a8c327d8c82f to your computer and use it in GitHub Desktop.
Zip folder ignoring files listed on .gitignore
#...
function gitzip() {
git archive -o $@.zip HEAD
}
#... gitzip ZIPPED_FILE_NAME
@LeonardoCardoso
Copy link
Author

@sadernalwis That's a good idea.

@zoutepopcorn
Copy link

zoutepopcorn commented Oct 15, 2020

I use one time

git config --global alias.zip 'archive HEAD -o' 

and then when you want..

git zip test.zip 

Ah sorry repost, sorry..

@ddieppa
Copy link

ddieppa commented Dec 9, 2020

used this one for windows Powershell:

git archive HEAD -o ../$(Split-Path -Path ${PWD} -Leaf)-$(Get-Date -UFormat "%Y.%m.%d-%H.%M").zip

@htho
Copy link

htho commented Sep 2, 2021

I got here when i looked for a command do backup the whole (local) repository including .git.

Here it is:

7z.exe a -bd ../archive.7z * '-xr@.\.gitignore'

Based on this answer: https://superuser.com/questions/28162/how-do-i-use-7-zip-to-backup-files-but-exclude-some-directories

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment