It appears that the default behaviour of SourceTree is to run git submodule update --init right after git checkout when switching branches. Is there an option to turn this off? I checked the preferences and couldn't find an option for this. I have written a post-checkout hook that sets the proper branch for my submodules. However, it runs before the git submodule update call, thus detaching the head again. If there is such thing as a post-submodule-update hook, I could move my hook but it doesn't appear that there is, so the only work around is to disable this feature in SourceTree.
Thanks!