Previous Entry Share
Automatic git backup
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

git push --force --all --quiet ~/develop/git/backup &
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).


Log in