title: How to check if it is a valid git repo
body: <p>I have a git repo B inside a git repo A. When I deleted .git/refs/ in repo B. The tag name of repo B immediately changed to repo A's branch name. It seems like Git think repo B is just a part of repo A.</p>
  
  <p>Then when I check status (git status) in repo B, it shows that git status</p>
  
  <blockquote>
    <p>fatal: 'b/.git' not recognized as a git repository</p>
  </blockquote>
  
  <p>I read the git cookbook, it said that .git/HEAD is used to detect if it is a valid git. In my situation, .git/HEAD is still existed but .git/refs/ . Result is that repo B is not recognized as a git repo.</p>
  
  <p>Anyone can help me to figure out how to check if a folder is a valid git ? what files or folders existence I need to be checked in the .git/ to make sure that it is a valid git ?</p>