2

Possible Duplicate:
Version control for independent developers?

I have a folder containing all my code (working code, experiment code). I'd like to back it up to a zip file on an external hard drive or whatever is best. How do you guys backup your code?
Do you setup your own source control server?
Do you use a script to zip all files?

2
  • What source control are you using? Let that be your guide.
    – JeffO
    Sep 24, 2011 at 21:17
  • for work, I use SVN, for hobby, I use git(github). The problem is that I don't want all my code pushed to github, which I only have a public account.
    – AZ.
    Sep 24, 2011 at 21:44

8 Answers 8

7

One word: Git.

Commit locally as often as you like, giving you a backup. Push remotely as often as you like, giving you an offsite backup. Have a full history of all changes, be able to fork locally and remotely, so that you can play around with ideas.

And it's dead easy to set up. It's not sooo easy to learn, but anyone who can learn to code can learn to use Git by experience.

4

I use BitBucket which provides both git and mercurial revision control systems. For free you can have unlimited private repositories (the only limits are on the number of people with access.)

For anything not in version control (mostly non-code stuff) I use dropbox.

2

Local personal projects: Git to a repo stored in my Dropbox account.

Local work projects: SVN to a remote server, and a rotating copy stored in my Dropbox just in case.

1

Locally : I would have the code in two drives, along with a copy of code in USB Pendrive

Internet : I use google project hosting, or microsoft sky-drive. There are other sites too like Codeplex, git-hub but i haven't used them.

IMO Internet is more secure, because one can't really expect Google and Microsoft to go down :-)

2
  • 1
    I don't understand your last line even with the smiley. Microsoft, Google, and Amazon have all had significant outages. Sep 24, 2011 at 21:59
  • 2
    outage is an altogether different scenario and every site on a network can have that. What I was emphasizing was on loss of data, which has seldom happened(if happened) to anyone. Sep 25, 2011 at 4:43
1

I write code on my Mac / Linux box and have a separate Linux shell account online with my Web host. So I wrote a shell script that tars and gzips my code's directory and then scp's it to my online shell account. The script kind of looks like:

#!/bin/csh -f

if ($#argv == 0) then
    echo "Usage: archive_and_upload.csh dir"
    exit 1
endif

set filename = $argv[1]

if (! -e $filename) then
    echo "$filename does not exist"
    exit 1

else if ((-e $filename) && (! -d $filename)) then
    echo "$filename exists but is not a directory"
    exit 1

endif

set timestamp = `date "+%Y_%m_%d__%H_%M"`

set output_link = "${filename}_${timestamp}"

if (-e $output_link) then
    echo "The link $output_link could not be created because it already exists."
    exit 1
else
    ln -sf $filename $output_link
endif

set output_tar_filename = "${output_link}.tar"
set output_targz_filename = "${output_tar_filename}.gz"


# Create tar file 

echo ""
echo "Creating tar file '$output_tar_filename'"

tar hcvpf $output_tar_filename $output_link
set tar_status = $status
if ($tar_status != 0) then
    echo "tar failed with status $tar_status"
    # Clean up
    if (-e $output_link) then
        rm $output_link
    endif
    exit 1
endif
echo "Done."


# Create gzip file 

echo ""
echo "Gzipping tar file '$output_tar_filename'"

gzip $output_tar_filename
set gzip_status = $status
if ($gzip_status != 0) then
    echo "tar failed with status $gzip_status"
    # Clean up
    if (-e $output_link) then
        rm $output_link
    endif
    exit 1
endif
echo "Done."


# Upload to the server

echo ""
echo "Uploading  '$output_targz_filename'  to server"
echo ""

scp -p $output_targz_filename  [email protected]:target/directory/ 

# Clean up
if (-e $output_link) then
    rm $output_link
endif

exit 0
1

Online backup service. There are many now. But a local cvs respostory is a good idea for backup of code, because the development history it provides is eventually invaluable.

0

I use one of these two techniques:

A. Use source control, github, google code, codeplex
B. If source control is overkill for your project, use dropbox or live mesh to basically duplicate code across multiple machines.

0

I do most of my work at home under Mac OS X. I have my own Subversion repository. I run TimeMachine, which does continuous backups of the entire system to an external drive. At the end of every month I swap external drives and take the offline drive to work for safekeeping. I'm sure there are TimeMachine equivalents for Linux and Windows.

Not the answer you're looking for? Browse other questions tagged or ask your own question.