Auto Updating with git Submodules

I like to be able to poke a remote machine and have it update itself (notes are in Remote Control Via ssh Keys). I also like to break projects up using git submodules.

These are my notes for setting up the remote machine’s project directory.

I’m no git wizard, so this may not be optimal; but it seems to work.

$ git clone --recursive [url] [directory]
$ git checkout [branch]
$ git submodule update --init --recursive
$ git submodule foreach git checkout [branch] 

The auto updater can then run:

$ git pull
$ git submodule foreach git pull 
This entry was posted in SysAdmin. Bookmark the permalink.

Leave a Reply