3

Is it redundant and unnecessary to periodically backup the files in a Git repo, that also has a remote repo? My understanding is all repositories are full backups. So an individual developer with a local repo pushing to a remote repo is two full copies of the data in the repo.

I guess there's always the chance that both copies (local and remote) can be lost, but that seems rather unlikely.

Is it just the paranoid IT person inside of me that still wants to do a backup of the files to different media? Is that completely useless and unfounded?

1
  • 2
    I usually keep 3-5 copies of my code bases, depending on the projects. Always my working copy, the repo, and a second local copy on a different machine in case of drive failure. But also copies on removable drives and online storage for my personal projects (where I'm responsible for the backups). Commented Mar 27, 2015 at 19:13

1 Answer 1

5

You're right that once a local repository is pushed to a remote location, both locations contain the successive revisions. Moreover, if somebody mistakenly erases some of the files and pushes this change to the remote repository, you can still recover those files with ease from the history.

What is the risk for both copies to be lost? It depends on the infrastructure in use. Consider those scenarios:

  • If you're using GitHub, for instance, the risk is extremely low.

  • On the other hand, if the remote location is your corporate server, then maybe it is not truly remote.

    What if it is in the same building where you work? What if a fire destroys both the server and your computer?

    If the server is really geographically remote, could it be that a virus will propagate to both the corporate server and your machine?

Explore how remote location handles the repository. If it's a corporate server, contact the IT guy who knows how backups are managed (if he don't know the answer, this is a bad sign).

  • How often do they make backups?
  • Do they have off-site backups?
  • Have they ever tested their backups, or they are waiting for a disaster to occur to discover that the latest working backup was made three years ago?

Even with solutions such as GitHub, on a bad day, you are at risk of losing your internet connection and at the same time screw your repository files. If waiting for internet connection to come back is not an option, then a local backup is a viable option.

It all comes to the cost of backup versus the risk of losing everything. You're probably already making a regular backup of your machine, backing up everything. Including your source code makes sense, even if you evaluated the risk of a disaster to be infinitely small.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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