Last active
June 30, 2019 18:52
-
-
Save Eduard-gan/ae8f6d2b15b9c931ba9cc7c4fdbbddb8 to your computer and use it in GitHub Desktop.
Git Submodules
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
# Add existing repo as a submodule in another repo(now it's super-repo) | |
- CD to super-repo | |
- git submodule add https://gitlab.com/e.gan/test-shared-repo.git some_generic_code (some_generic_code is a name of directory under which the code from submodule will reside) | |
- git commit -am "I linked a somerepo as submodule some_generic_code" | |
# Update or downgrade version of submodule to latest in super-repo | |
- CD to some_generic_code (the submodule repo is now manages by "git" command) | |
- git checkout master | |
- CD out of some_generic_code to parent directory(super-repo) | |
- git commit -am "I downgraded submodule some_generic_code" | |
# Clone super-repo | |
git clone https://gitlab.com/e.gan/test-shared-repo.git --recursive | |
# Pull latest changes in super-repo AND submodules | |
cd root_of_super_repo | |
git pull --recurse-submodules |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment