User Tools

  • Logged in as: anonymous (anonymous)
  • Log Out

Site Tools


mantisbt:git_submodules

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mantisbt:git_submodules [2014/04/30 11:58]
dregad Added submodule status check paragraph
mantisbt:git_submodules [2014/04/30 13:00] (current)
dregad Added update from within the submodule (phpmailer example)
Line 120: Line 120:
 Submodule path '​library/​adodb':​ checked out '<​commit sha>'​ Submodule path '​library/​adodb':​ checked out '<​commit sha>'​
 </​code>​ </​code>​
 +
 +
 +
  
  
Line 128: Line 131:
 This section describes the process to update a submodule when a new version of a library has been released upstream. This section describes the process to update a submodule when a new version of a library has been released upstream.
  
-The examples ​given here are for the ADOdb library, but the same logic should apply (possibly with some variations) to other submodules as well.+==== 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 (//​upstream//​ for the library'​s official repository and //origin// for the MantisBT fork) We assume that you already have a local repository configured with the appropriate remotes (//​upstream//​ for the library'​s official repository and //origin// for the MantisBT fork)
  
Line 135: Line 140:
 cd /​path/​to/​local/​adodb cd /​path/​to/​local/​adodb
 git fetch upstream git fetch upstream
 +</​code>​
 +    * Optional: update the //master// branch <​code>​
 +git rebase upstream/​master master
 </​code>​ </​code>​
     * Update the branch <​code>​     * Update the branch <​code>​
Line 142: Line 150:
     * Resolve any conflicts     * Resolve any conflicts
     * Push changes to the fork <​code>​     * Push changes to the fork <​code>​
-git push origin +git push origin ​--tags master mantis-1.3 
-</​code>​+</​code> ​Note that it's not strictly necessary to push the tags or the master branch. Having the tags allows a better description of the submodule'​s current commit when running ''​git submodule''​ (see example at the end of this section)
   - Update the submodule   - Update the submodule
     * Go to your local mantisbt repository and update it<​code>​     * Go to your local mantisbt repository and update it<​code>​
Line 156: Line 164:
 cd .. cd ..
 </​code>​ </​code>​
-  - Update ​readme.libs to reflect the new version+  - Update ​''​README.libs'' ​to reflect the new version
   - Commit the changes <​code>​   - Commit the changes <​code>​
 git commit -a git commit -a
Line 165: Line 173:
 <​code>​ <​code>​
 $ git submodule ​ $ git submodule ​
- ​9346d288a1b7f7a50cc35b6a0e56d29e9d000ecf adodb (v5.18a-144-g9346d28)+ ​9346d288a1b7f7a50cc35b6a0e56d29e9d000ecf adodb (v5.19-6-g9346d28)
  ​75a4e5595c0dfcb2e2e1e41b9ba2282828d3f292 disposable (release-2.0.0-3-g75a4e55)  ​75a4e5595c0dfcb2e2e1e41b9ba2282828d3f292 disposable (release-2.0.0-3-g75a4e55)
  ​cb771839899d9f6be9f1268b986c30327ff1199b phpmailer (v5.2.6-2-gcb77183)  ​cb771839899d9f6be9f1268b986c30327ff1199b phpmailer (v5.2.6-2-gcb77183)
  ​41beaddd279c695aacb63407e2c98b04b7eaff51 securimage (heads/​mantis)  ​41beaddd279c695aacb63407e2c98b04b7eaff51 securimage (heads/​mantis)
 </​code>​ </​code>​
 +
 +==== 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**:​ if you update the submodule in-place, it is critical that you actually push the changes to //origin// otherwise the other developers will have an corrupted repository with missing commits when they pull the changes.
 +
 +  * Update the submodule from upstream <​code>​
 +cd library/​phpmailer
 +git fetch upstream
 +git rebase upstream/​master master
 +git checkout mantis
 +git merge v5.2.7
 +# Resolve conflicts
 +</​code>​
 +  * Push changes to the fork - **don'​t forget this step !**<​code>​
 +git push origin --tags master mantis
 +cd ..
 +</​code>​
 +  * Edit ''​README.libs''​
 +  * Commit the changes <​code>​
 +git commit -a
 +</​code>​
 +
  
mantisbt/git_submodules.1398873518.txt.gz · Last modified: 2014/04/30 12:15 (external edit)