How do I store my previously-written code?

published Feb 17, 2006, last modified Jun 26, 2013

Slashdot | How Do You Store Your Previously-Written Code? asks a fairly simple question.

With a fairly simple response:

Subversion. I do Subversion for a living. You may choose another version control system, such as DARCS or SVK, but I use Subversion. I organize my code in:

trunk/
branches/
tags/

form, which allows me to perform most common repository operations (merge, branch, tag) fairly quickly and without worries.

After I've pronounced a release stable enough, I tag the release (by copying the trunk/ into tags/release-x.y.z. Then, I check it out, and make a tarball out of it, which I place on a separate folder.

Each project gets its own repository. Each project also gets a unique folder named after the project's name, which usually contains a TO-DO list in text form, a checkout of the trunk/ for that project's repository, and assorted files and documentations (or symbolic links to my knowledge base folder, Information collection). In each project folder, I also have a subfolder which contains each release in source tarball form, and (if the project needs compilation for a target platform) the compiled installable packages (.tar.gz, or RPM)

I help myself by using Trac. It couples fairly well with Subversion, letting me know how my project is evolving, and letting me see colored differences for each revision.

All in all, use a version control system. That, along with regular backups, ensures you have full productivity and complete history of your work.