How can I fully delete a Git repository created with init?
How can you completely remove a Git repository that was initialized using git init?
What steps are required to delete all Git tracking data and ensure the project is no longer version-controlled?
To fully delete a Git repository that was created using git init, you mainly need to remove the hidden .git folder inside your project directory. This folder stores all version control information including commit history, branches, and configuration. Once it’s deleted, your project will no longer be tracked by Git.
Steps to delete a Git repository
- Locate the project folder where you had previously run git init.
- Show hidden files/folders (because .git is hidden by default):
- Windows: enable “Show hidden items” in File Explorer.
- Mac/Linux: Press Cmd + Shift + . or run ls -a in terminal.
- Delete the .git folder:
On Windows (Command Prompt):
rmdir /s /q .gitOn Mac/Linux (Terminal):
rm -rf .gitConfirm the deletion by running:
git status If Git responds with “fatal: not a git repository”, it worked!
Important Notes
- Deleting .git does not delete your project files — only the version control metadata.
- If you have a remote repository (like GitHub), deleting the local .git folder won’t remove the remote repo. You must delete that manually on the hosting service if needed.
- Make sure you really don’t need the commit history before removing .git — it cannot be recovered afterward unless you have a backup.
By removing the .git directory, your project becomes a normal folder again with no Git tracking involved.