drosofff
6/10/2016 - 1:47 PM

Track upstream git submodules (ansible roles in our case) updates

Track upstream git submodules (ansible roles in our case) updates

git checkout -b update_submodules
git submodule update --remote
git add roles/galaxyprojectdotorg.galaxy*
git commit -m "Track upstream role updates"
git push origin update_submodules

git submodule update --remote

   --remote
       This option is only valid for the update command. Instead of using the superproject's recorded SHA-1 to update the
       submodule, use the status of the submodule's remote-tracking branch. The remote used is branch's remote
       (branch.<name>.remote), defaulting to origin. The remote branch used defaults to master, but the branch name may
       be overridden by setting the submodule.<name>.branch option in either .gitmodules or .git/config (with .git/config
       taking precedence).

       This works for any of the supported update procedures (--checkout, --rebase, etc.). The only change is the source
       of the target SHA-1. For example, submodule update --remote --merge will merge upstream submodule changes into the
       submodules, while submodule update --merge will merge superproject gitlink changes into the submodules.

       In order to ensure a current tracking branch state, update --remote fetches the submodule's remote repository
       before calculating the SHA-1. If you don't want to fetch, you should use submodule update --remote --no-fetch.

       Use this option to integrate changes from the upstream subproject with your submodule's current HEAD.
       Alternatively, you can run git pull from the submodule, which is equivalent except for the remote branch name:
       update --remote uses the default upstream repository and submodule.<name>.branch, while git pull uses the
       submodule's branch.<name>.merge. Prefer submodule.<name>.branch if you want to distribute the default upstream
       branch with the superproject and branch.<name>.merge if you want a more native feel while working in the submodule
       itself.

Thus:

  • checkout a new branch in repo with submodules
  • git submodule update --remote
  • Then a PR.