{"thread":{"id":"38160","subject":"local clone and submodules","startedAt":"2014-12-10T20:36:58Z","lastAt":"2014-12-10T20:36:58Z","messageCount":1,"participants":["Jack Nagel"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"253534","messageId":"CAMYxyaV3dvHFQJ1vfmZy7Hv=XHtSCSbi6s7FWdrUzdmyKWvntA@mail.gmail.com","threadId":"38160","inReplyTo":null,"subject":"local clone and submodules","fromName":"Jack Nagel","fromEmail":"jacknagel@gmail.com","sentAt":"2014-12-10T20:36:58Z","receivedAt":"2014-12-10T20:36:58Z","isPatch":false,"sender":{"key":"jacknagel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/568243?v=4"},"body":"Say I have a local repository with several submodules that point at\nremote repositories. All submodules are up-to-date.\n\nI want to clone everything to another location on disk, *without\nhitting the network to fetch the submodules*. Obviously a simple \"git\nclone\" will work for the superproject, but submodules will be\nre-fetched from the remote if I pass --recurse-submodules.\n\nIs there any way to do this offline? Reading through the\ndocumentation, it doesn't seem easy, but perhaps it is possible to do\nby recursing through the submodules manually.\n\nIn Homebrew, we allow building packages directly from a project's\nsource repository. Currently, the repositories are downloaded into a\nlocal cache, then checked out into a build directory using \"git\ncheckout-index\" and \"git submodule foreach\". However, some projects\nrequire access to the git repository to do things like compute a\nversion string.\n\nWe experimented with using GIT_DIR, but sometimes we are operating on\nmultiple git repositories, and saving and restoring its value in the\nright places is tedious and error prone.\n\nOur current solution is to symlink the .git directory into the build\ndirectory, but I'd like to replace this manual checkout + symlink with\nsomething cleaner. I could just copy the entire repository from the\ncache into the build directory, but we deal with some fairly large\nrepositories so I would prefer to be able to use \"git clone\" or \"git\nclone --shared\".\n\nThanks for any suggestions,\nJack\n"}]}