To uninitialize a git repository, you simply need to remove the folder named ".git" in your repository folder. For example, by manually dragging/deleting the folder or by using the remove command in terminal like so:
rm -rf .git
r flag means, remove recursively and the
f flag means force (to force-remove protected files).
Before removing the ".git" folder, please ensure that you're in the correct repository, because removing it means you will lose all of your repository's history.
This post was published (and was last revised ) by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.