How do I git clone a repo, including its submodules? Git 2 23 (Q3 2019): if you want to clone and update the submodules to their latest revision: git clone --recurse-submodules --remote-submodules <repo-URL> If you just want to clone them at their recorded SHA1: git clone --recurse-submodules <repo-URL> See below Note that Git 2 29 (Q4 2020) brings a significant optimization around submodule handling See commit a462bee (06 Sep 2020) by Orgad
Pull latest changes for all git submodules - Stack Overflow For git 1 7 3 or above you can use (but the below gotchas around what update does still apply): git submodule update --recursive or: git pull --recurse-submodules if you want to pull your submodules to latest commits instead of the current commit the repo points to See git-submodule (1) for details
git - How to create submodule in existing repo - Stack Overflow git submodule update --remote --merge will fetch the latest changes from upstream in each submodule, merge them in, and check out the latest revision of the submodule As [the docs] [1] put it: --remote This option is only valid for the update command Instead of using the superproject’s recorded SHA-1 to update the submodule, use the status of the submodule’s remote-tracking branch This
How can I specify a branch tag when adding a Git submodule? How does git submodule add -b work? After adding a submodule with a specific branch, a new cloned repository (after git submodule update --init) will be at a specific commit, not the branch itself
Git update submodules recursively - Stack Overflow 452 My project struture ProjectA -FrameworkA (submodule) --Twig (submodule of FrameworkA) How I can update submodules recursively? I already tried some git commands (on ProjectA root) git submodule foreach git pull origin master or git submodule foreach --recursive git pull origin master but cannot pull files of Twig
git - How do I remove a submodule? - Stack Overflow In modern git (I'm writing this in 2022, with an updated git installation), this has become quite a bit simpler: Run git rm <path-to-submodule>, and commit This removes the filetree at <path-to-submodule>, and the submodule's entry in the gitmodules file I e all traces of the submodule in your repository proper are removed
git - Update a submodule to the latest commit - Stack Overflow git submodule update only works without flags when a commit has been pulled (in proj B) that updates the refs to the submodule (s) in question (proj A) To update proj B to reference the HEAD of the remote tracking branch for proj A, you'll want to do git submodule update --remote --merge as shown in Paul Hatcher's answer below