OK, changes made as per your suggestion.  

I'm not sure it's the right thing to do tho, since the output is different to the way the git command itself works.  For instance if I do a ```git submodule add repo``` I would end up with a ```.git``` file in my subrepo directory, the contents of which point back to my main ```.git``` directory at a subdirectory of that which then houses all the usual files and directories you'd expect to find.  Doing the checkout and then running the ```submodule_add``` over the top of that houses all the indexing files and directories in ```.git``` directory of the subrepo.

It's only a small difference I'll grant you, those file need to live somewhere, but it's the kind of thing that could break in the future.  I've done a bit of digging, and I think I know how to do the fetch of the remote head, so I'll plod on with that and do another commit later.  You can then choose to take whichever implementation takes your fancy.