Remote-tracking branch rather than with the SHA-1 recorded in the superproject. Pass a -remote switch to the implicit git submodule update command forĪny use case where you want the submodules to be checked out on their When using git clone -recurse-submodules there was previously no way to (Merged by Junio C Hamano - gitster - in commit 9476094, ) clone: add -remote-submodules flag See commit 4c69101 () by Ben Avison ( bavison). You can initiate fetching the submodule using multiple threads, in parallel.įor instances: git fetch -recurse-submodules -j2Įven better, with Git 2.23 (Q3 2019), you can clone and checkout the submodule to their tracking branch in one command! Update 2016, with git 2.8: see " How to speed up / parallelize downloads of git submodules using git clone -recursive?" With version 1.6.5 of git and later, you can do this automatically by cloning the super-project with the –-recursive option: git clone -recursive git:///mysociety/whatdotheyknow.git See Working with git submodules recursively for the init part. If -recursive is specified, this command will recurse into the registered submodules, and update any nested submodules within. This change reduces the time for git fetch ( man) in my repo from 25s to 6s.Īs joschi mentions in the comments, git submodule now supports the -recursive option (Git1.6.5 and more). Similar logic can be found in cat-file, pack-objects and more. Notify setup_revisions() that the input is not filenames by passing assume_dashdash, so it can avoid redundant stat for each ref.Īlso suppress refname_ambiguity flag to avoid filesystem lookups for each object. The argv argument of collect_changed_submodules() contains only object ids (the objects references of all the refs). (Merged by Junio C Hamano - gitster - in commit 2ce9d4e, ) submodule: suppress checking for file name and ref ambiguity for object ids See commit a462bee () by Orgad Shaneh ( orgads). Note that Git 2.29 (Q4 2020) brings a significant optimization around submodule handling. If you just want to clone them at their recorded SHA1: git clone -recurse-submodules For this example, we're going to clone the Microsoft Visual Studio Code repo.Git 2.23 (Q3 2019): if you want to clone and update the submodules to their latest revision: git clone -recurse-submodules -remote-submodules It will only save to the Linux file system if you tell it to.Ĭloning from GitHub basically requires you to get a web address to feed into the Git client. WSL distros can also access the Windows filesystem so if you're using Linux on your Windows box, the same idea applies. So if you want to put it somewhere specific, find the right location in File Explorer then right-click and open in PowerShell/Windows Terminal. When you clone the repo in the terminal, it will create your local folder inside whatever directory your command line is in at that point. Git is platform-agnostic, so you can learn it once and use it everywhere. Whether you're working within PowerShell using Git for Windows or you're inside WSL, the commands you need are the same. Cloning is essentially downloading, in so much as you point your local Git client at the destination on GitHub and it will pull the content down, creating a new directory on your local machine. Source: Windows Central (Image credit: Source: Windows Central)Ĭloning is one of the most basic functions of Git and one that you can use happily without getting in the weeds too much if all you're interested in is being able to pull content from GitHub.
0 Comments
Leave a Reply. |