Quantcast
Channel: yoush.homelinux.org » English
Viewing all articles
Browse latest Browse all 10

Quick backup with git

$
0
0

There are probably many ways. But this one looks pretty simple and takes seconds.

git add . && git commit -m "backup-$(date +%Y%m%d-%H%M)" && git reset HEAD^

After this command, nothing is changed in working tree or in branch history. But reflog gets a reference to the current tree content, which could be extracted (git help reflog) if you suddenly realize that you’ve messed things up.

Con’s: depends on proper .gitignore to avoid garbage in repository; can’t be used if there is something valuable in the staging area; reflog has limited lifetime, decreased even more by large rebases


Viewing all articles
Browse latest Browse all 10

Trending Articles