mantisbt:git_submodules
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| mantisbt:git_submodules [2013/08/30 19:51] – Solution for Submodules --> Submodules dregad | mantisbt:git_submodules [2014/04/30 13:00] (current) – Added update from within the submodule (phpmailer example) dregad | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Working with Git Submodules in MantisBT ====== | ====== Working with Git Submodules in MantisBT ====== | ||
| - | |||
| - | // | ||
| Some [[3rdpartycode|3rd party libraries]] are stored and maintained in the MantisBT repository | Some [[3rdpartycode|3rd party libraries]] are stored and maintained in the MantisBT repository | ||
| - | using [[http:// | + | using [[http:// |
| This setup requires some special handling when initializing the repository and when switching branches, | This setup requires some special handling when initializing the repository and when switching branches, | ||
| Line 122: | Line 120: | ||
| Submodule path ' | Submodule path ' | ||
| </ | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ===== Updating a Library' | ||
| + | |||
| + | This section describes the process to update a submodule when a new version of a library has been released upstream. | ||
| + | |||
| + | ==== Updating via an external repository ==== | ||
| + | |||
| + | The example given here are for the ADOdb library, but the same logic should apply (possibly with some variations) to other submodules as well. | ||
| + | We assume that you already have a local repository configured with the appropriate remotes (// | ||
| + | |||
| + | - Update the library' | ||
| + | * Get the latest from upstream < | ||
| + | cd / | ||
| + | git fetch upstream | ||
| + | </ | ||
| + | * Optional: update the //master// branch < | ||
| + | git rebase upstream/ | ||
| + | </ | ||
| + | * Update the branch < | ||
| + | git checkout mantis-1.3 | ||
| + | git merge v5.19 | ||
| + | </ | ||
| + | * Resolve any conflicts | ||
| + | * Push changes to the fork < | ||
| + | git push origin --tags master mantis-1.3 | ||
| + | </ | ||
| + | - Update the submodule | ||
| + | * Go to your local mantisbt repository and update it< | ||
| + | cd / | ||
| + | git checkout master | ||
| + | git pull | ||
| + | </ | ||
| + | * Go to the submodule' | ||
| + | cd library/ | ||
| + | git checkout mantis-1.3 | ||
| + | git pull | ||
| + | cd .. | ||
| + | </ | ||
| + | - Update '' | ||
| + | - Commit the changes < | ||
| + | git commit -a | ||
| + | </ | ||
| + | |||
| + | At this point, checking the submodules' | ||
| + | |||
| + | < | ||
| + | $ git submodule | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | |||
| + | ==== Updating from within the submodule ==== | ||
| + | |||
| + | It's worth mentioning that step 1 above can also be performed straight from the submodule itself (see example below for phpmailer), provided of course that the remotes (origin and upstream) have been properly configured. | ||
| + | |||
| + | **WARNING**: | ||
| + | |||
| + | * Update the submodule from upstream < | ||
| + | cd library/ | ||
| + | git fetch upstream | ||
| + | git rebase upstream/ | ||
| + | git checkout mantis | ||
| + | git merge v5.2.7 | ||
| + | # Resolve conflicts | ||
| + | </ | ||
| + | * Push changes to the fork - **don' | ||
| + | git push origin --tags master mantis | ||
| + | cd .. | ||
| + | </ | ||
| + | * Edit '' | ||
| + | * Commit the changes < | ||
| + | git commit -a | ||
| + | </ | ||
| + | |||
mantisbt/git_submodules.1377906717.txt.gz · Last modified: (external edit)
