Explore Courses Blog Tutorials Interview Questions
+5 votes
in DevOps and Agile by (19.4k points)
edited by

I want to remove Git tracking from a project's directory. What is the correct method to do this? Can I do a shell command such as

rm -rf .git

from my projects directory or is there a way to do this as a Git command?

I used this project to learn Git and realize I made some mistakes early on in the project with moved, renamed and deleted files. I'd like to remove all Git tracking and start fresh with git init.

1 Answer

+6 votes
by (27.5k points)
edited by

rm -rf .git should do the task. however check that that your operating copy is within the exact state that you wish it, as a result of everything else are lost. .git folder is hidden thus make sure you switch on the Show hidden files, folders and disks choice.

From there, you'll be able to run git init to create a new repository.

For more information about installation of git and common git commands please go through the following link:


Browse Categories