'Git Bash - Accidentally called git init from Bash on complete C:\ hard drive

I am new to Git Bash and i have accidentally called git init inside the Git Bash when the pwd was C:\. Now in my Windows Explorer there are question marks and check marks on every folder icon.

enter image description here

How can i get rid of those marks again?

I have tried several things like using git rm, but they dont work. The icons dont go away.

I thought about using git clean, but this looks like it deletes the files from my file system, which would destroy my Windows installation.

Here is the git status output: enter image description here



Solution 1:[1]

Easiest way to undo or remove the initialization of git in a directory i.e. the .git folder or in simple words git references. Navigate to that specific directory and open git bash there.

git bash will show you the name of branch written in front of it

enter image description here

in my case it's master written in round brackets

just run the following command:

rm -rf .git

and all of the references will be gone and you can start over by running the command:

git init

It'll initilize an empty git repository for you at the path specified.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shoaib Khalil