A quick Git/Mercurial with Dropbox primer
28 Sep 2012If you want dirt-cheap (possibly free) backups for your source code, you can drop a Git or Mercurial repository in Dropbox and work from that. I’ve been doing both for 2 years or so and have never had an issue.
If you’ve never used either Git or Mercurial, I recommend starting with Mercurial and taking 20 minutes to read through Hg Init: a Mercurial Tutorial by Joel Spolsky.
Git
Create your Git project as you usually would:
$ git init /path/to/repoCreate a bare repository in Dropbox:
$ git init --bare /path/to/Dropbox/repoAdd the Dropbox location as a remote within your normal project:
git remote add dropbox /path/to/Dropbox/repoAny time you want to push to Dropbox, run:
git push dropboxMercurial
Create your Mercurial project as you usually would:
$ hg init /path/to/repoCreate a Mercurial repository in Dropbox:
$ hg init /path/to/Dropbox/repoEdit the .hg/hgrc file within your repository, and add a couple lines that look like:
[paths]
default = /path/to/Dropbox/repoWhenever you want to push to Dropbox, run:
$ hg push