This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
git [2014/09/02 17:31] – admin | git [2014/09/02 18:09] – [Create a Submodule] admin | ||
---|---|---|---|
Line 44: | Line 44: | ||
- | ====== Git Submodules ====== | + | ====== Git Submodules |
+ | ===== Create a Submodule ===== | ||
+ | |||
+ | To link one repository into another in git you can use a thing called submodules: | ||
+ | |||
+ | git submodule add http:// | ||
+ | |||
+ | Example: | ||
+ | |||
+ | cd / | ||
git submodule add https:// | git submodule add https:// | ||
git add . | git add . | ||
git commit -m "Add submodules ..." | git commit -m "Add submodules ..." | ||
- | | + | |
+ | |||
+ | ===== Clone a Repo containing submodules/ ===== | ||
+ | |||
+ | Submodules need to be initialized and downloaded | ||
+ | |||
+ | cd / | ||
+ | git submodule init | ||
+ | git submodule update | ||
+ | |||
+ | |||
+ | ===== Update a submodules repo ===== | ||
+ | |||
+ | When updating a submodule its required to tell the parent repository to use the latest downloaded version. | ||
+ | |||
+ | cd / | ||
+ | git pull origin master | ||
+ | cd / | ||
+ | git commit -am " | ||
+ | git push origin |