Git Submodules

Over the last few days I have run into a number of issues using git submodules. Perhaps mostly user error on my part. Overall if its just a project I am working on than I think its a reasonable amount of complexity to introduce, but otherwise in particular when working with a team that is relatively new to git they are probably not the answer. Here are some links and notes.

fatal: no submodule mapping found in .gitmodules for path

git submodule status                  
 7cf09a922ebcfdce5c6571d26a79555c98366fa9 public (heads/master)
fatal: no submodule mapping found in .gitmodules for path 'website/themes/beautifulhugo'

via: stackoverflow

git rm --cached themes/beautifulhugo

Correct way to remove a submodule

This was frustratingly difficult to track down good current information on since at some point the deinit option was added.

via: stackoverflow

Hugo Themes not as a submodule

In all of the above I would eventually get the submodule clean. Then clone and try to re-add them theme. But I missed the step about removing the .git directory, so it was always going back to an undesired state.

Bonus

Save some clicks:

hugo new post/`date +"%Y-%m-%d".md`