This is completely theoretical, but I'm new to Git and Linux so I want to know.

If I accidentally manage to do git init inside e.g Desktop or Home directory, how to prevent any possible disaster from happening?

git init creates hidden .git directory where it's config-files are so is it just so simple to remove this hidden directory?

Would the directory it was in become "normal" again instead of git master branch?

Or would removing .git cause some problems? Like the directory trying to identify itself as git repository but cannot find the configs?

1 Answer 1


If you run git init in a directory which isn’t already a git repository, removing .git will reverse all the effects of git init without any other side-effects.

  • Figured as much. Makes sense since there are no other directories connected to git. (outside of git install directory)
    – K4R1
    Apr 16, 2019 at 13:34
  • Yes, the nice thing about Git (as I understand it) is all of the files managed by it (for the current working branch) are just regular files on the filesystem. Git itself doesn't go anything but track files and metadata about them as well as the same for files in all of the other branches for that repository. It only actively changes those files when you switch between branches.
    – 0xSheepdog
    Apr 16, 2019 at 14:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .