One of the many benefits of keeping a git repository inside dropbox

O

A couple of weeks ago, for a number of reasons, I had polluted my working copy so much, i decided it would be easier to simply blow my cloned repository folder away, and re-clone.

So, I deleted the folder, and made a fresh checkout to the same place.

Today, I was about to resume work on a feature I’d started; you guessed it, around 2 weeks ago.
It was on a separate branch – a branch, which had been lost when I deleted the folder containing my git checkout.
Naturally, I had not pushed this branch.

Uh oh, I thought.. but not for long.

I use my Dropbox folder as my main folder for nearly all my files on my machine – projects, docs, photos etc…
As I’m sure you know, Dropbox allows you to restore previous version of a file to a previous revision (or undelete)

The only trouble is, you can’t do this on a directory level.

I found this project on github – https://github.com/clark800/dropbox-restore
This enables you (via the simple command line interface) to restore an entire directory within your dropbox folder to a previous date.

Using this, I was able to roll back my entire folder containing my git repository to a point in time – before I’d deleted it.
Sure, I could have done this with reflog – but that wouldn’t have helped if I hadn’t committed changes!

Once I’d used the script to roll back, my working directory was as it was prior to me deleting it – some files staged, some not!
Lifesaver!