Intellij IDEA: fatal: bad revision 'HEAD'

git, intellij-idea

Solution

You can't just create a git directory on a parent directory of a repository, and expect things to work. It would help to know what you are actually trying to achieve, but a wild guess is that you probably want to have a look at git submodules.

Problem

I was working with my project with `git` within `Intellij IDEA` and everything was fine. Then I created a new repository which included the current one. I have updated `Version Control` section in `Preferences` to point to a new root folder, where IDE shown me two 'Git roots'. I included both. Result: IDEA does not track any changes in files and pop ups the error: `fatal: bad revision 'HEAD'`. Also IDE states all my files are not versioned. Any ideas? Thanks.

Original source