spacepaste

  1.  
  2. #!/bin/bash
  3. # clean up previous runs
  4. rm -rf /tmp/child /tmp/child.git /tmp/parent
  5. #
  6. # dummy child project
  7. #
  8. cd /tmp
  9. git init child
  10. cd child
  11. echo "Hello" > README.md
  12. git add . && git commit -m "initial commit"
  13. #
  14. # fake remote of child project
  15. #
  16. cd /tmp
  17. git clone --bare file:///tmp/child
  18. #
  19. # Create parent repo with child submodule
  20. #
  21. cd /tmp
  22. git init parent
  23. cd parent
  24. mkdir vendor
  25. git submodule add -b master file:///tmp/child.git vendor/child
  26. git commit -m "initial superproject commit"
  27. #
  28. # do an update to the child project
  29. #
  30. cd /tmp/child
  31. echo "Bye" >> README.md
  32. git commit -a -m "update readme"
  33. git remote add origin file:///tmp/child.git
  34. git push -u origin master
  35. #
  36. # go back into superproject and try to update
  37. #
  38. cd /tmp/parent
  39. git submodule update --remote
  40. cd vendor/child
  41. git status
  42. git version
  43. # last 4 lines of output...
  44. # Submodule path 'vendor/child': checked out 'e6ee142b76dd926ff723f819351ccef1ddd5c38c'
  45. # HEAD detached at e6ee142
  46. # nothing to commit, working tree clean
  47. # git version 2.9.3
  48.