0

I am beginner with git. A few weeks ago, I unintentionally created a "git init" on the root of my pc (location: desktop) which means all of my computer files are on that git folder.

How can i delete that git folder, without losing any of my coding or personal files?

2 Answers2

0

You should have a hidden folder .git in the root directory then. You just have to delete that folder. It will delete only the git repository and leave all of the other files intact.

  • Will the .git folder that I delete somehow destroy the other git repositories that are below the root location? – user3040230424 Dec 11 '22 at 09:13
  • No, those repositories have their own `.git` folders in their directories and they will stay intact just like the other files. – CaptainKidd Dec 11 '22 at 18:32
0

That's ok, I think that's happenened to any of us haha.

From your terminal, after navigating to your home directory (cd ~ if on MacOS, cd \user\username if on Windows), find the directory of this new project, then you can just run rm -rf <project-directory-name>.

If you just want to remove Git from your directory without removing the whole project, you can just remove .git at the root directory of it (cd <project-directory-name>, then rm -rf .git).

ale917k
  • 1,494
  • 7
  • 18
  • 37