Created
May 3, 2016 08:34
-
-
Save nst/df99f00154ae59794be3dc7054a0f651 to your computer and use it in GitHub Desktop.
use git submodules
This file contains 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 Submodule__ | |
git submodule add https://github.com/username/Module | |
┌─────────────────────────┐ | |
│ MyProject │ | |
│ ┌────────────────┐ │ | |
│ │ Module │ │ | |
│ └────────────────┘ │ | |
└─────────────────────────┘ | |
--- | |
__Clone Project__ | |
git clone https://github.com/username/MyProject | |
┌─────────────────────────┐ | |
│ MyProject │ | |
│ ┌ ─ ─ ─ ─ ─ ─ ─ ─ │ | |
│ Module │ │ | |
│ └ ─ ─ ─ ─ ─ ─ ─ ─ │ | |
└─────────────────────────┘ | |
__Update Submodule__ | |
git submodule update --init | |
┌─────────────────────────┐ | |
│ MyProject │ | |
│ ┌────────────────┐ │ | |
│ │ Module │ │ | |
│ └────────────────┘ │ | |
└─────────────────────────┘ | |
--- | |
__Update Submodule to Latest Version__ | |
git submodule foreach git pull origin master | |
git commit -m "use latest version of module xxx" | |
┌─────────────────────────┐ | |
│ MyProject │ | |
│ ┌────────────────┐ │ | |
│ │ Module │ │ | |
│ │ latest version │ │ | |
│ └────────────────┘ │ | |
└─────────────────────────┘ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment