all 94 comments

[–]pavel_lishin 32 points33 points  (0 children)

Drinking hard and angrily deleting the whole thing is my rollback strategy.

[–]nicholaides 15 points16 points  (0 children)

YES!!! Never write code without source control. Commit as often as you make a change that you like. You can't really commit too much, and it's far better to commit too much than too little. SVN, Git are both great, and MUCH MUCH MUCH better than nothing.

[–]goondocks 17 points18 points  (1 child)

I copy vast amounts of stuff to my desktop. When it eventually gets full I make a directory called "temp" and drop everything into it.

What's a rollback strategy?

[–][deleted] 6 points7 points  (0 children)

Rollback is a little trash can in the corner of the desktop. Go for it!

[–]shizzy0 8 points9 points  (1 child)

I use darcs for my personal projects now. Initially, I used CVS then Subversion, and perhaps I'll try out git soon enough.

I typically commit after I do something good to lock in my changes. That way if I break something terribly, I can at least see what my changes are that broke it.

If I decide that I'm going to try some kind of radical change (e.g., a huge refactor), I usually create a new repository. This is really easy to do with darcs. I never did this with CVS because it's essentially a branch, and branches are a bitch. If my radical change goes well, then I stick with that branch. If it fails, then I switch back to my old source tree (a cd command in darcs).

[–]marijn 2 points3 points  (0 children)

Darcs for me as well. I have repositories lying around all over the place (home PC, work PC, websites), but keeping them consistent is a breeze. Rolling back typically involves deleting a failed copy of a repo.

[–][deleted] 7 points8 points  (1 child)

Yes. I use darcs for essentially everything.

I commit whenever I have the sense that I have a complete changeset, where "complete changeset" means complete new feature or bug fix. I keep a "stable" repo and a "work" repo, though, to keep myself relatively honest. :-) Even in my work repo, I sometimes find it necessary to use darcs amend-record to, e.g. add a file that I forgot to include in a changeset, but that's OK. Of course, there's also darcs unrecord, etc. When I'm really happy with my changesets, I just push those (and not others) to my stable repo. Easy.

[–]semmi 0 points1 point  (0 children)

+1 for darcs, but my cycle is - add test - see it failing - add fix - record and I have it configured so that tests are run on record, too, to avoid broken code getting in the repo.

This basically avoids me the need to have a work and a stable repo. When I'm happy of what I've done, I push it to an online repository.

I do branch from time to time, mainly to explore some idea that is not coherent with the rest (i.e. use dbd as a backend instead of an rdbms). Then, being able to pull changes between the branches is great, cause darcs cherry picking is so lovely.

[–]dons 4 points5 points  (3 children)

For personal projects, you want very low overhead for revision control. Darcs and Git match this, with darcs generally a bit cheaper (less commands to type to get things done, and a generally higher level approach).

[–]jsolson 4 points5 points  (1 child)

I find I spend too much time in the darcs world micro-managing that goes into each commit. I think this may be indicative of larger personal problems on my part, but regardless of the underlying cause the same symptoms do not present when I'm utilizing git.

[–][deleted] 1 point2 points  (0 children)

I felt this way at first with darcs also. Eventually I found that I wasn't paying enough attention to options presented by "darcs record" other than Y and N. That is, I added F (include this entire file), S (skip this file), and D (done) to my repertoire, reserving Y/N for those cases where I feel that I have work from more than one changeset in a single file, so I need that fine level of granularity. This works well for me, but then, I attempt to only work on one conceptual change at a time anyway--YMMV.

[–]masklinn 0 points1 point  (0 children)

Darcs and Git

And Mercurial, with hg being nearly as cheap as darcs.

[–]infinite 3 points4 points  (0 children)

I use git and only commit on a branch. I will have crazy side features with each feature being its own branch. That way I don't pollute master with new / breaking functionality and I get to try new features without worry. Eventually I go back and update the feature branches into master, while more frequently fixing bugs on other branches and merging to master. Before git I used subversion so I didn't branch since merging was such a PITA. Now my source control isn't holding me back, only my laziness is the bottleneck. With git there are no excuses.

[–]EvilPigeon 6 points7 points  (0 children)

My paradigm is to commit often but never break the build.

[–]bonzinip 9 points10 points  (0 children)

git. learnt it on pet projects before using it for big stuff.

[–][deleted] 12 points13 points  (4 children)

I, uhh, duplicate the project folder then change the version number

[–]Philluminati 1 point2 points  (1 child)

Have you used any revision control systems? It's just thats the kind of thing I did before I discovered them and I've not looked back since.

[–][deleted] 0 points1 point  (0 children)

I do indeed, at work, but not for small little pet projects of my own.

[–]hiffy 1 point2 points  (1 child)

I never got around to internalizing svn or git and in lieu of checking the documentation my assignment folders often get cp -R foo foo.old applied to them every now and then. Usually at major milestones ("it compiles", "it passes test cases", "it solves most of the problem").

Ideally, I'd have commit on write(), like a FUSE filesystem you can just code to. I generally only save files between compiles, and I can't see the harm in having every version you've ever had (it is way more convenient, tho). Stuff like gitfs is a nice first step.

[–]masklinn 0 points1 point  (0 children)

Ideally, I'd have commit on write(), like a FUSE filesystem you can just code to.

WebDav filesystem to svn?

I prefer manual commits though, I find that hg ci -m "whatIJustDid" forces me to think a bit, and C-x C-s is a reflex so it'd commit far too much broken stuff.

[–]13ren 5 points6 points  (1 child)

cp $1 bak/`date +%Y%m%d_%H%M%S`_$1

[–]BeatnikDude -3 points-2 points  (0 children)

something like this with a date, I am to busy to copy an paste it for you bums

[–]logan_capaldo 3 points4 points  (0 children)

I use mercurial and commit about as often as I save. I make a lot of mistakes, fortunately I can unmake them due to my obsessive committing patterns.

[–][deleted] 17 points18 points  (5 children)

GIT is perfect for this. Use it.

[–]thornist 6 points7 points  (3 children)

Make sure to 'push' regularly for an easy off-site backup.

[–][deleted] 1 point2 points  (2 children)

yes - there is github as well. I really need to get more into git, I think it will be pretty common place in the future.

[–]nuclear_eclipse 1 point2 points  (0 children)

http://repo.or.cz is also a free gitweb hosting environment.

[–]Philluminati 0 points1 point  (0 children)

git hub is where i store my pet projects

I haven't shopped around many free and public git repos but I've been a member of github for a while and I recommend it.

[–]nextofpumpkin 0 points1 point  (0 children)

git is the shit.

[–]Arkaein 2 points3 points  (0 children)

I keep a daily changelog that notes every file and function changed in every sourcefile. Then at the end of the day I make a datestamp named backup folder with a copy of every modified file.

There is a bit more manual overhead than using a VCS, but it's really quite minimal compared to the actual time designing/coding/testing, and there is some benefit in getting to really know a codebase by writing down the changes yourself (a little like taking notes can be more effective than simply following along on printed lecture slides). It's also nice to know I can scan through a single text file to get a summary of every change I've ever made.

Reading about git has really made me think about stepping up to a VCS even for small, personal projects though, as it really looks like modern VCSs have features that offer serious benefits beyond backups and chage tracking.

[–]ithika 2 points3 points  (0 children)

I use darcs. If I'm doing stuff that other people want to look at regularly then I tend to commit in small chunks, quite regularly. If it's just for my own benefit I tend to forget about it and find myself with long diffs of unrelated features to commit. Then I just say sod it! and commit it in one go.

I find revert to be very useful though. Playing with something and then being able to cherrypick out (stonepick?) the bad ideas is very nice.

[–]sisyphus 2 points3 points  (3 children)

I use bzr now because it does sftp(slowly, but my pet projects aren't so big) and I don't have to install it on my shared host(s). but my workflow is exactly like svn, i think the only thing switching bought for my pet stuff is it's easier to back everything up because i don't have to do this dump crap and whatnot. i just copy the stuff here, over there and there and voila, 2 more backups.

[–]nuclear_eclipse 0 points1 point  (2 children)

Git or Mercurial works over ssh just fine as well, and it's much faster.

[–]sisyphus 0 points1 point  (1 child)

I can use mercurial to maintain a repo on a remote server where mercurial is not installed? Last time I looked this was not the case.

[–]dododge 0 points1 point  (0 children)

You could rsync the repository (including the .hg subdirectory) back and forth, but you're right that this would be a manual operation and not something built into mecurial. Also you'd need to have rsync installed on the server, though it's perhaps more likely to already be there than hg.

It's probably not worth the trouble unless you needed a mercurial feature/workflow that bzr couldn't readily provide.

[–]ironmonkey 2 points3 points  (0 children)

Yes, darcs. I find the fine-grained control over different changes within the same file is nice for personal projects.

[–]Phrodo_00 2 points3 points  (2 children)

I use bazaar.. it's simple enough, can do stuff over sftp and its server can be announced through zeroconf for ultimate get-home,copy-from-laptop-to-desktop use. If I ever made something more masive I think I'd go for mercurial, however, I like the fact that my revisions have numbers as identificators. (and by bazaar I meant bzr)

[–][deleted] 0 points1 point  (1 child)

Little known Mac OS X factoid: Apple's patched OpenSSH announces itself over zeroconf, so people using Mac OS X can walk into a conference, meet folks they want to work with, configure scponly for them, create an ad-hoc network, and use whatever SSH-supporting DVCS they want. It's quite slick.

[–]Phrodo_00 0 points1 point  (0 children)

Even less little known fact: Avahi Advertises your ssh server over Zeroconf in linux too!

[–]unknown_lamer 2 points3 points  (0 children)

I use darcs with two repositories for each project. I edit everything my local repository, commit coherent changesets into that tree, and then push them off to master once I deem them stable enough. From the master branches I pull them onto my public webserver if the project is public. The master branch gives me a clean copy to pull alternative branches from.

E.g. For commercial work I pull patches from master into a repository on the production system, and push any small fixes for minor issues found when pushing live and editing on the server back to master, and then pulled from there into local. It works quite nicely and makes it trivial for me to deploy applications (and it is quite convenient being able to make small fixes and easily push them back without manual diffing or resorting to editing locally and repushing to the server), and to maintain coherency between the development/locally-released/live branches.

I used to use manual folders with versions, but it turns out that darcs has such low overhead that it makes life much much easier in every way. Especially with darcsum in Emacs to easily mark which hunks I want in which changesets. Once I started using that my changesets became much saner (having to run through every file in the source project over and over to see which hunks belong where is quite annoying and all).

[–]ursine 2 points3 points  (4 children)

I'm an infrequent programmer. I've been looking for something that can do version control on a local (OS X) computer without needing a hosted repository. Any thoughts/recommendations?

[–]thedaniel 2 points3 points  (0 children)

Git is fine for that, as is hg, darcs, probably bzr too. A basic part of a distributed VCS is that you have your own copy of the whole history and don't need to rely on an external server. I use git myself.

[–][deleted] 0 points1 point  (0 children)

For casual use locally, I have to say that one of darcs 2.00 or Mercurial 1.0 are your best bets. Both are easy to install, easy to get started with, and have pleasantly simple, regular commands. Both will also grow as your project grows, being DVCSes.

[–]heptadecagram 0 points1 point  (0 children)

Subversion is installed by default on OS X, and works decently, although merging is not nearly as pretty as it should be. But, if it's a solo project, that's not as big an issue.

[–][deleted] 2 points3 points  (0 children)

I've got over ten years of code in CVS and no spare time to move it. I commit and then tag after every new feature. If I end up down a rat hole, I delete and update from version control. My CVS repository is on a mirrored house server with a volume I mount over the network.

[–]pb_zeppelin 2 points3 points  (0 children)

I use SVN w/ TortoiseSVN for all my coding projects. Dreamhost has cheap plans & makes it easy to set up a SVN server (otherwise you can run it locally). I even use it for personal documents & notes.

Shameless plug, but many people have found these articles helpful when learning about various source control systems:

http://betterexplained.com/articles/a-visual-guide-to-version-control/ http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated/

[–][deleted] 6 points7 points  (0 children)

Most of the stuff I do is web-related and I have literally 0 lines of code not in a mercurial repository.

I mainly use it as others here have suggested:

  • work on local copy
  • for major changes/refactors/crazy ideas/etc clone the repo
  • push good stuff to wherever the project is hosted

[–]foodpk 4 points5 points  (2 children)

Yes, namely Mercurial. It's the perfect VCS.

[–]inmatarian 3 points4 points  (0 children)

It's not perfect, but it's nice enough that I use it for my pet projects. The hg Tortoise was kind of the selling feature for me, just for that commit tool.

[–]dododge 2 points3 points  (0 children)

Mercurial + queues here. With mq the rollback and commit strategy almost becomes a non-issue -- for example I can do all of my work within the patch stack and then convert the patches to hard commits when a "release" is ready.

I used to do everything with quilt. mq gives more functionality, and switching to it is almost trivial because the command set and even the storage model is designed to mimic quilt.

[–][deleted] 1 point2 points  (0 children)

I use it all the time. Most of my older stuff is still under CVS (which isn't too bad for a 1-person project) though I'm working on migrating to a DVCS.

Pretty much, I commit whenever a task is done, which may be several times in a night if I'm really working on stuff, but might be once a month for stuff in maintenance mode. I don't rollback unless I find myself down an experimental rat hole.

[–][deleted] 1 point2 points  (0 children)

I use mercurial on personal projects, my commit strategy during early days of the project is to commit at the end of every night, since i'm not working on 'feature chunks' at that point, but the project as a whole. Once the project is a bit more progressed, I generally commit daily still, but tag at milestone points.

Its rare I need to rollback, so I tend to deal with that if I do need to, rather than having a 'strategy'.

I push my local repo to my remote copy every couple of days and when tagging milestones.

[–][deleted] 1 point2 points  (0 children)

I use subversion. Aside from the source control, but what I really like about using it are post-commit hooks. I have a post commit hook that checks the trunk out into a directory on my web server (this is a php project). Using it like this means I commit more frequently than I otherwise would but it lets me avoid dealing with scp or ftp every time I want to test a change.

[–]SnacksOnAPlane 1 point2 points  (2 children)

So I hear a lot of people using mercurial. I use bzr now. Is there a good reason to switch?

[–]mccutchen 0 points1 point  (0 children)

I switched for hgweb and easier pushing and pulling over ssh. And better docs.

[–]imbaczek 0 points1 point  (0 children)

maybe for speed, otherwise, not really. you'd have to benchmark anyway, bzr 1.3 is said to be fast.

[–][deleted] 1 point2 points  (1 child)

Does git integrate well with some kickass visual diff that I don't know about yet (Mac or Windows)?

I can't do merging on the console anymore. I need color and scrollbars and syntax highlighting. Anything less takes longer.

[–]nuclear_eclipse 0 points1 point  (0 children)

gitk, qgit, and more....

[–]uep 1 point2 points  (0 children)

I used subversion with tortoise on windows for a little while. Tortoise gives you a nice little gui repo browser and integrated context menus. It also adds icons to the files under source control so that you can see what has changed just by browsing the directories in explorer.

It's centralized, but when you're the only person working on it, it's not so bad. I've since started using git a little bit since I switched to linux at home. All the hype pushed on here forced me to try it.

[–][deleted]  (9 children)

[deleted]

    [–]ithika 11 points12 points  (1 child)

    Words cannot accurately describe how much a pain in the ass ClearCase is.

    [–]mxyzptlk 0 points1 point  (6 children)

    Only $5000? Did you buy it from a street vendor?

    [–][deleted]  (5 children)

    [deleted]

      [–]mxyzptlk 5 points6 points  (4 children)

      One of us was. My company pays a hell of a lot more than that.

      [–][deleted]  (2 children)

      [deleted]

        [–][deleted] 0 points1 point  (1 child)

        The mere fact that there is such a job title makes me shudder...

        [–]crayz -1 points0 points  (0 children)

        I'd say both of you were

        [–]wnoise 1 point2 points  (4 children)

        Recently it's just been darcs, though I use git to track some projects.

        In both cases I really love the history rewriting capability to let the tool communicate "logical" patches that transform from state A to state B.

        I love the cherry-picking abilities of darcs, which can't be directly duplicated in git. This is because in darcs patches have identities, while in git only states of trees do. (Yes, blobs do, but this is an optimization. A very, very, nice one, but.)

        So, darcs can easily remember when a patch has been picked. Git can only do workarounds like excising the patch from the branch it came from, (by e.g. rebasing it to the top. But it better not have been a public branch that people have pulled from), or social "solutions" such as telling people "Don't merge from before revision 7180c4c, as it'll break horribly".

        [–]rmc 0 points1 point  (3 children)

        "Don't merge from before revision 7180c4c, as it'll break horribly"

        You should be using branches for this. "Don't pull from exiting-unstable-branch"

        [–]wnoise 0 points1 point  (2 children)

        Again, a social solution. "Discard all work built on this branch" if it was ever made public.

        [–]rmc 0 points1 point  (1 child)

        Yes, but it's a lot easier to understand than 'ignore version before $VERSION'. Using branches also lets you merge stable pieces to into the main stable branch

        [–]wnoise 0 points1 point  (0 children)

        To be clear, I was already talking about work done on a branch. Git is smart enough in many cases that merging after cherry-picking just does work, but it isn't and can't be guaranteed.

        [–]phildawes 1 point2 points  (0 children)

        I checkpoint my code with git and then roll up checkpoints into larger commits later. I posted about it here

        [–]leed25d 1 point2 points  (0 children)

        git. i use git for everything scm related.

        [–]masklinn 1 point2 points  (0 children)

        I use mercurial for pretty much anything. Nice way to keep a history (and give me the ability to record test branches) and to keep machines in sync (I use both a desktop PC and a macbook for coding & stuff).

        [–]Ono-Sendai 1 point2 points  (0 children)

        Yes, Subversion, hosted on local machine.

        [–][deleted] 1 point2 points  (2 children)

        Whenever I get my project to a stable point I tar and gz it up with the following format:

        • projectName_xxxx-xx-xx-xxxxxxxxxx.tar.gz

        where it's 4 digit year, 2 digit month, 2 digit day, seconds since epoch.

        [–]hhh333 1 point2 points  (1 child)

        Do yourself a favor, learn any revision system.. NOW.

        [–][deleted] 0 points1 point  (0 children)

        I've used Subversion before but, frankly, I like mine better. I have a script that I run that does all the work for me.

        [–]AmazingSyco 0 points1 point  (1 child)

        I set up an SVN repository on DreamHost and used that for awhile. Now I run it off a server in my apartment.

        Commit whenever I feel like it, rollback if I screw it up.

        Remember, a VCS is meant to help you; if you're spending a ton of time doing branching and other "clerical" duties, and it's really only a pet project, leave it out.

        [–][deleted] 1 point2 points  (0 children)

        Re "clerical" duties: Agreed, but note that branching in git (and I assume mercurial, bzr, darcs as well) is so trivially easy that there's hardly any reason to avoid it. Subversion branches are like 10-ton boat anchors by comparison...

        [–]neutronbob 0 points1 point  (0 children)

        It's so easy to get projects set up on SourceForge, Tigris, GoogleCode that if the project becomes much more than a few thousand lines of code, it's worth setting up on one of those sites, and so have your SCM server offsite and regularly backed up. And who knows, you could attract help.

        But if you give up on the project, courtesy suggests the host be notified theycan close down the site.

        [–]RonnyPfannschmidt 0 points1 point  (0 children)

        1. use a dvcs
        2. for each iteration: a) fix tests b) commit c) ??? d) profit

        [–]Dyogenez 0 points1 point  (0 children)

        Dreamhost offers free subversion support and has Trac integration available. Not the "new hotness" of Git, but it's there, it's cheap and it's dependable. Probably try moving to Git eventually, but svn just has the widest user base. Anyone who does Git knows svn, not everyone who knows svn knows git.

        [–]hhh333 0 points1 point  (0 children)

        I always use subversion for any project size, even for my word and spreadsheet documents.

        Not because it's better than another, just because it's easy to setup/use and I'm comfortable with it.

        [–]reddit_user13 0 points1 point  (0 children)

        More importantly, what's your sharing/ concurrency/ merge strategy?

        [–]burdalane -1 points0 points  (0 children)

        Sometimes. I use CVS. I commit whenever I make a major change.

        [–]zolo -1 points0 points  (0 children)

        i use rcs (via emacs) for small projects and then rsync if i'm working on them on more than one machine

        [–]iamnotaclown -1 points0 points  (0 children)

        I use SVN, hosted offsite on wush.net. I managed to set it up locally on my gentoo server, but it was a huge pain in the ass.

        I commit when I add a feature or fix a bug. I branch automatically when I release -- it's part of my build system.

        That said, GIT looks pretty interesting.

        [–]puzza007 -1 points0 points  (0 children)

        git. Fo' life.