4 # put all of this in some directory (eg. /home/micah/bin/superproject-post-push.sh) and then do this in the git submodule directory:
5 # micah@minnow:~/leap/puppet/modules/apt$ git config alias.xpush "push && /home/micah/bin/superproject-post-push.sh"
7 # use git xpush for pushing
9 # this assumes a couple things:
10 # 1. you do the commit in the top level of the submodule (not any subdirectory within)
11 # 2. you have no local, uncomitted changes in your superproject when you do any submodule commit
16 # change this variable to your superproject checkout
17 superproject=${HOME}/leap/puppet
19 submodule_base=`basename $PWD`
20 submodule=${submodule_base#puppet_}
22 # check out the latest version of the superproject
23 # note: this part is fragile, because if you have local, uncomitted changes in your superproject, then this pull will fail
26 git submodule update --init
28 # check out latest version of submodule
29 # according to https://we.riseup.net/riseup+tech/puppet-git-submodules
30 cd ${superproject}/modules/${submodule}
32 git merge origin/master
34 # commit and push the submodule update commit
37 git commit -m "automatic update of submodule $submodule_base"