Skip to content

Instantly share code, notes, and snippets.

@lovebdsobuj
Created November 7, 2016 03:11
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 lovebdsobuj/bfd4405049ebea9fd009359d83fc6380 to your computer and use it in GitHub Desktop.
Save lovebdsobuj/bfd4405049ebea9fd009359d83fc6380 to your computer and use it in GitHub Desktop.
git archive - export git as zip
#!/bin/sh
git init # on the root of the project folder
git add .
git commit -m "git archive"
FOLDERNAME="Backup"
FILENAME="archive_$(date +%d)_$(date +%m)_$(date +%Y)_$(date +%I)$(date +%M)$(date +%S)"
mkdir -p "$FOLDERNAME"
git archive HEAD --format=zip > Backup/$FILENAME.zip
echo Press Enter to Close this Window...
read
@lovebdsobuj
Copy link
Author

Create .gitignore on the root of the project folder.

And add this

/Backup
/Backup/*.zip

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