Do not fear git rebase : make snapshots !
About 1 min read
Git is a nice version system, but some commands are destructrive, such as rebase.
Here is a script to have a safety net, and free backups !
#! /bin/sh # Script to snaphot a git repo SNAP_VERSION=$(date +%s) BUNDLE_NAME=$(basename $( pwd )).${SNAP_VERSION}.git.bundle git bundle create ../${BUNDLE_NAME} --all git remote add snap-${SNAP_VERSION} ../${BUNDLE_NAME} git fetch -p snap-${SNAP_VERSION}
Usage is very easy. If you want to restore your current branch to the master one you made earlier.
git reset --hard snap-1365068411/master