The configuration inside the submodule. Submodules allow you to include or embed one or more repositories as a sub-folder inside another repository. For instance, switching branches with submodules in them can also be tricky with Git versions older than Git 2.13. To add a child repository to a parent repository: $ git submodule add < URL to Git repo > To initialize an existing Git submodule: $ git submodule init. A git remote -v inside that submodule will display it. `--remote` documentation in linkgit:git-submodule[1] for details. remove the submodule from that file. Any git command that you perform inside a sub-module directory are executed in the context of that sub-repository. This pulls in new commits into the main repository and its submodules. See the `update` documentation in: linkgit:git-submodule[1] for details. The command line for those commands that support taking submodules as part of their pathspecs. If you create a new branch, add a submodule there, and then switch back to a branch without that submodule, you still have the submodule directory as an untracked directory: Commit these changes to a branch so we can create a request for peer review before merging the changes to the submodule, and create a respective branch on the main project to go with it. git push origin master References. Most commands have a boolean flag --recurse-submodules which specify whether to recurse into submodules. If you track branches in your submodules, you can update them via the --remote parameter of the git submodule update command. is the URL of the new submodule’s origin repository. $ git submodule update --remote Create repositories with submodules. Usually, it … git add .gitmodules; 1.2 Edit .git/config.git/config has a similar entry, edit that file as well. For many projects, submodules aren’t the best answer (more on this below), and even at their best, working with submodules can be tricky, but let’s start by looking at a straight-forward example. cd path/to/your/submodule git checkout -b branch --track origin/branch # if the master branch already exist: git branch -u origin/master master (with 'origin' being the name of the upstream remote repo the submodule has been cloned from. Working in a sub-module is like working in any other git repository. A record in the .gitmodules (see gitmodules[5]) file at the root of the source tree assigns a logical name to the submodule and describes the default URL the submodule shall be cloned from. 1.3 Remove the submodule from git tracking. submodule..fetchRecurseSubmodules:: This option can be used to control recursive fetching of this It also changes the working directories of the submodules to the commit of the tracked branch. Submodules are composed from a so-called gitlink tree entry in the main repository that refers to a particular commit object within the inner repository that is completely separate. Examples are grep and checkout.Some commands take enums, such as fetch and push, where you can specify how submodules are affected.. + This branch name is also used for the local branch created by: non-checkout cloning updates. git commit -m "Replaced Library1 directory with submodule."