all repos — website @ 4891f4523b2b0e11c21eec8716afe54eb1d58e5d

My website

post/git-cloning-similar-repositories.md (view raw)

+++ description = “Speed up cloning of similar git repositories” title = “Cloning Similar Git Repositories” date = 2014-06-22T08:35:24Z [taxonomies] tags = [“git”] +++ With multiple similar git repositories, for example where a base repository contains a framework or base system installation and other repositories are created from that repository, it’s possible to save some time when cloning down another repository by using the reference option to git-clone:

git clone git@github.com/my/repo --reference another-repo

(Where another-repo points to a local version of a repository.)

The reference here doesn’t have to be the base repository itself, it could just be another variant of it. The speedup can be quite dramatic if the repositories have megabytes of shared history, from minutes to seconds.

On a related note, I’m surprised that GitHub doesn’t allow for multiple renamed forks, which would be very useful in this scenario. BitBucket does support this, however. It even has a ‘sync’ button for pulling updates from the base into the child repositories, which is very useful, especially for those who prefer GUIs over CLIs.