init repository
git init <repository-name> --bare
submodules
git checkout <commit-id>
git submodule deinit --all -f
git submodule update --init --recursive
Problem fixing
$ git status
fatal: index file smaller than expected
$ rm .git/index
$ git reset HEAD .
$ git status
detached head
if no changes have been made
$ git checkout -
(checks out the last checked out branch). Alternatively check out the branch again (e.g. git checkout master)