Skip to content

Instantly share code, notes, and snippets.

@p404
Created April 30, 2016 14:46
Show Gist options
  • Save p404/af733e2ac48fa3f0b2b69403ee4a7200 to your computer and use it in GitHub Desktop.
Save p404/af733e2ac48fa3f0b2b69403ee4a7200 to your computer and use it in GitHub Desktop.
Bash script that recollect all files ignored in a git project by the .gitignore file
#!/bin/bash
## Git ignore backup script
function compress() {
files=$(grep -v '^\s*#' < .gitignore)
env GZIP=-9 tar cvzf $1.tar.gz $files 2> ignore_backups_errors.txt
exit 0
}
if [[ -z "$1" ]]; then
compress backup_ignore
else
compress $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment