Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dropbox-style svn/git/mercurial?: auto-commit upon change and auto-checkout

I'm not a professional programmer, but I do some small solo projects and I would like some versioning and syncing, but going through the process of remember to commit and checkout (on different computers) is more of a hassle than, say, keeping code in a dropbox folder that automatically uploads to the cloud upon file change. Using the current copy is completely transparent to me, but there is no versioning. (Syncing is also a pain because I often don't open my laptop for days after getting home.)

Is there a way to have a codebase automatically commit upon file change (or just every few minutes) and automatically download the latest version if I want to continue my work from another computer?

Thanks!

like image 553
jpmorris Avatar asked Aug 15 '11 00:08

jpmorris


2 Answers

It depends on what your "projects" are.

Flashbake was created after science-fiction writer Cory Doctorow wanted to automatically capture and version his writing process at regular intervals:

Every 15 minutes, Flashbake looks at any files that you ask it to check (I have it looking at all my fiction-in-progress, my todo list, my file of useful bits of information, and the completed electronic versions of my recent books), and records any changes made since the last check, annotating them with the current timezone on the system-clock, the weather in that timezone as fetched from Google, and the last three headlines with your by-line under them in your blog's RSS feed (I've been characterizing this as "Where am I, what's it like there, and what am I thinking about?"). It also records your computer's uptime. For a future version, I think it'd be fun to have the most recent three songs played by your music player. (source)

It is based on git for versioning, and cron for automatic updates (git is sufficiently space-efficient to make this tractable). You may want to look at another review. The code is here.

If you really, really want file modification detection rather than a commit every X minutes (aka. paranoid about data), you may want something based on inotify (details - note those automated commits may add up quickly !).

Yet another option (that doesn't necessarily solve the auto-commit question, so you may want to mix) is to look at running git over dropbox. This has already been discussed here on SO.

like image 111
Francois G Avatar answered Sep 30 '22 04:09

Francois G


Dropbox keeps few versions of files in history. Hardly can be called "versioning", but you can restore files to some time back in the past.

If you really can not be bothered with commiting and merging, I'd say just live with dropbox, as it is nice and automatic.

You can set up Scheduled Task (if on Windows) or Cron Job (if Linux) that will make a commit/push every 5 minutes. And pull/update every time you start your computer. But I can see a potential nightmare waiting to happen, especially on pull/update, when manual merge is required.

Also, I'd advise using Mercurial, as it is much easier to learn/deal with than git, and more advanced than svn. This will take away some pain from version-control system.

like image 43
trailmax Avatar answered Sep 30 '22 04:09

trailmax