Can a local Git clone be considered a complete backup of the repo it was cloned from?

A clone can be considered a full backup of all the data in your remote repository, but not necessarily the meta-data (that’s where the --mirror switch comes in). Your clone will contain all the commit, tree, blob, branch, and tag objects that are in any way referenced by the repository. That means your backup will contain all your source code, history, and associated branches or tags.

The difference with the --mirror switch is that without it, the clone won’t include things like remotes that have been created on the server. These are not important in a “I hope I haven’t lost any source!” kind of way, but they may be for getting your server back up and running like it was.

If you’re interested in creating a backup that can be restored onto the server like there was never any issue, then you should use --mirror, but for most scenarios a simple clone is fine.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)