Skip to content

Updating submodules

tomrake edited this page Nov 23, 2014 · 1 revision

submodule are not magic they are git indirection

googlecharts uses the git submodule facility

The googlecharts example uses git submodule. see https://www.kernel.org/pub/software/scm/git/docs/git-submodule.html for reference documentation.

General Discussion on nested repos

Git uses a series of indirection method to make it appear that two separate repos are contained in the other. In the case of amber-examples the googlecharts repo appears at amber-examples/googlecharts. When working with these two repo you need to keep in mind theres is a branch of each repo, googlecharts and amber-examples that you need to keep in sync. Generally you modify the inner repo first and push those changes to github then you work on the outer repo where the inner repo is internally represented as a commit hash of detached branch by a special git file. You commit that file in the outer repo and do a pull request of the outer repo.

Actual steps on updating the googlecharts submodule

I git clone amber-examples.git --recursive which also clones all submodules. Then create a branch in the submodule to work on the updates. Keep in mind there are two repos you are dealing with: (1. amber-examples 2. googlecharts) and you will need a branch in each repo to perform an update.

~> git clone git@github.com:amber-smalltalk/amber-examples.git --recursive
~> cd amber-examples
~amber-examples> git checkout -b update-googlecharts-branch // This is the outer repo branch
~amber-examples> cd googlecharts                      // Change to the submodule
~amber-examples> git checkout -b my-updated-feature-branch-name  // create the inner repo branch

Now you add the update features and test. And you decide you need to update. First push the changes to the googlecharts repo because the inner repo commit must be on github

~amber-examples/googlecharts> git commit -m 'My final version changes message'
~amber-examples/googlecharts> git push origin my-updated-feature-branch-name // inner repo branch is published
~amber-examples/googlecharts> cd ..  // Now switch to the outer repo
~amber-examples> git add googlecharts // This adds the reference to the inner repo branch to the outer repo branch
~amber-examples> git commit -m 'Update googlecharts to...' //  We commit the outer repo branch 
~amber-examples> git push origin update-googlecharts-branch // We push the outer repo branch so we can do a pull request.

Offer a pull request for your update-googlecharts-branch when that request is merged you are done.