Learn how to remove Git initialization from a local repository with a step-by-step guide. Perfect for undoing accidental Git setups and managing your version control effectively.
You ran git init in the wrong folder. Or you’ve decided this project doesn’t need version control after all. Either way, you want Git gone. Here’s the honest answer: there’s no git uninit command. Undoing git init just means deleting the .git folder.
What git init actually did
When you ran git init, Git created one hidden folder named .git in your project’s root. That folder holds everything: your commits, branches, config, the whole history. The folder is the repository. Delete it and the directory goes back to being an ordinary directory. Your actual project files stay untouched.
Remove the repository
Open a terminal in your project’s root and run this on macOS or Linux:
rm -rf .gitOn Windows, use the Command Prompt equivalent:
rmdir /s /q .gitThat’s it. No confirmation prompt, no undo. This deletes all of your commit history for good, so make sure you don’t need it before you hit enter. If there’s any chance you’ll want that history back, push it somewhere first.
Confirm it’s gone
Check your work with:
git statusIf the repository is really gone, Git tells you so:
fatal: not a git repository (or any of the parent directories): .gitSee that message and you’re done. The folder is a plain directory again, ready to re-init, move, or hand over to a different version control system. If you ever want it back under Git, just run git init again.


