Skip to content

Instantly share code, notes, and snippets.

@ratopi
Last active January 13, 2017 22:10
Show Gist options
  • Save ratopi/a0401edafbd9376f7ecc to your computer and use it in GitHub Desktop.
Save ratopi/a0401edafbd9376f7ecc to your computer and use it in GitHub Desktop.
Backup with GIT

backup with git

#!/bin/bash
# Set GIT_DIR and GIT_WORK_TREE before calling it!
#
# export GIT_DIR=/tmp/BUWG/x.git
# export GIT_WORK_TREE=/tmp/BUWG/test/
b="backup-$( date '+%Y%m%d-%H%M%S' )"
git checkout --orphan "$b"
git add .
git commit -m "$b"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment