tyggerjai: (Default)
tyggerjai ([personal profile] tyggerjai) wrote2011-08-10 11:58 pm

One for the nerds....

So I now have 2 or 3 machines I use for tinkering with the little projects I have, and I'd like to keep the code synched. There are many tools for this, of course, and I'm not wanting to start a religious war about which tool I should use, but rather seeking advice on how to use them best :)

Assume, for the sake of argument, that I have access to git and/or subversion. Assume, for the sake of argument, that I have a ~/Code directory, which has, of course, a Python directory and a Perl directory, which then contain project directories and library directories.

Assuming for the moment that I don't care so much about synching "broken" code - in that I want to be able to half-finish something on the desktop, commit it to the repo, and check it out on the laptop to keep tinkering - as much as I care about the latest version, is my best strategy to commit ~/Code en masse and then just update en masse?

Or should I commit each project individually to the repo, so I can branch later if need be?
thorfinn: <user name="seedy_girl"> and <user name="thorfinn"> (Default)

[personal profile] thorfinn 2011-08-11 02:54 am (UTC)(link)
Separate projects should be kept in separate repositories. Putting multiple projects in the one repository is just asking for confusion. If things are related sufficiently then they're probably the same project.

That said, to solve the synchronisation of *working* space problem, you *could* put the whole thing inside your Dropbox folder. That isn't so good for large projects involving binary builds, but for scripting language projects, it's great. And then you don't have to worry about forgetting to commit code (and you should *also* be using a code repository, but it then fulfils its correct function - keeping a history of your code, as opposed to being misused for a function it's not designed for - keeping directories in sync).
Edited 2011-08-11 02:57 (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)

[personal profile] afuna 2011-08-11 04:31 am (UTC)(link)
In that case, I'd probably do separate repositories, and then toss them all into Dropbox to solve the always syncing issues >_>

I've tried both models, and have found that the one-big-blob approach quickly gets frustrating because you have leftover commits all over the place (even though I started out intending to be okay with broken commits, in practice it didn't work out!). It also makes it difficult to share just one project with a friend at a future date.

With the multiple repos approach, things are nicely separated, and even when there's a broken commit it's easy to pick back up on it the next time you're working on that section of code because you can just look at the log for head/tip/whatever, but there is a chance that you'll forget to sync one at the end of a coding session before you move on to another one. Perhaps you could write a script that goes over and syncs everything just before you logout?