Last active
August 29, 2023 13:43
-
-
Save dabitdev/2f1239bc98e6b45fbe2e72daaeb1e271 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Creating repositories with submodules | |
#### Adding a submodule to a Git repository and tracking a branch | |
If you add a submodule, you can specify which branch should be tracked via the -b parameter of the submodule add command. The git submodule init command creates the local configuration file for the submodules, if this configuration does not exist. | |
# add submodule and define the master branch as the one you want to track | |
``` | |
git submodule add -b master [URL to Git repo] | |
git submodule init | |
``` | |
first command it adds a new submodule to an existing Git repository and defines that the master branch should be tracked | |
second command initializes submodule configuration | |
## Cloning a repository that contains submodules | |
If you want to clone a repository including its submodules you can use the --recursive parameter. | |
`git clone --recursive [URL to Git repo]` | |
If you already have cloned a repository and now want to load it’s submodules you have to use submodule update. | |
``` | |
git submodule update --init | |
# if there are nested submodules: | |
git submodule update --init --recursive | |
``` | |
### Including the subfolder as module in root/settings.gradle | |
``` | |
include ':A' | |
include ':B' | |
project(':moudle').projectDir = file("another-repo/module") | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment