Previous Entry Share
Automatic git backup
x31eq
Make a backup repository like

mkdir backup
cd backup
git init --bare


In the repository you want to back up

cat > .git/hooks/post-commit <<fin
#!/bin/sh
#

git push --force --all --quiet ~/develop/git/backup &
fin
chmod u+x .git/hooks/post-commit


The reflog isn’t kept but you can still find old heads with git fsck --unreachable

It might work differently with remote backups (which obviously make more sense).
Tags:

?

Log in