Making backupsΒΆ

As well as helping to keep track of different versions of a project, version control systems are hugely useful for keeping backups of your code with minimal hassle.

Making a copy of your repository is as simple as moving to the location where the backup will be, and then using the git clone command.

$ cd /Volumes/USB_DRIVE
$ git clone ~/my_network_model
$ cd ~/Dropbox
$ git clone ~/my_network_model
$ ssh cluster.example.edu
(cluster)$ git clone ssh://my_laptop.example.edu/my_network_model

You can then keep the backup in-sync with the main repository by either using git pull in the backup location, or using git push in your working directory:

$ cd ~/my_network_model
$ git push /Volumes/USB_DRIVE/my_network_model master
Everything up-to-date

Why is this better than just copying the files? Because you no longer have to worry about versions or about over-writing your changes. i.e., no more:

“Now, is the version on my USB key newer than my local version? Did I change any files on my laptop?”

or:

Cartoon from "Piled Higher and Deeper" by Jorge Cham