Uninitialize git repository

Issue

I have Initialized a git repository and have made some commit in that now for some reason I do not want to track any files in it and want to remove git from my local repo.
Is there some way I can Uninitialize it?

Solution

git stores all the repository related data in a folder named “.git” inside your repository folder. So you just want to keep your files but change it into a “not-git-repository”. Warning: this is irreversible!

cd path/to/repo
rm -rf .git

The only files that might remain are hidden “.gitignore” files (but only if you added them yourself or using some tool like eclipse). To remove them:

find . -name ".gitignore" | xargs rm

Answered By – Chris Maes

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published