-
- #!/bin/bash
-
- # clean up previous runs
- rm -rf /tmp/child /tmp/child.git /tmp/parent
-
- #
- # dummy child project
- #
- cd /tmp
- git init child
- cd child
- echo "Hello" > README.md
- git add . && git commit -m "initial commit"
-
- #
- # fake remote of child project
- #
- cd /tmp
- git clone --bare file:///tmp/child
-
- #
- # Create parent repo with child submodule
- #
- cd /tmp
- git init parent
- cd parent
- mkdir vendor
- git submodule add -b master file:///tmp/child.git vendor/child
- git commit -m "initial superproject commit"
-
- #
- # do an update to the child project
- #
- cd /tmp/child
- echo "Bye" >> README.md
- git commit -a -m "update readme"
- git remote add origin file:///tmp/child.git
- git push -u origin master
-
- #
- # go back into superproject and try to update
- #
- cd /tmp/parent
- git submodule update --remote
- cd vendor/child
- git status
- git version
-
- # last 4 lines of output...
-
- # Submodule path 'vendor/child': checked out 'e6ee142b76dd926ff723f819351ccef1ddd5c38c'
- # HEAD detached at e6ee142
- # nothing to commit, working tree clean
- # git version 2.9.3
-