How do I remove version tracking from a project cloned from git?
All the data Git uses for information is stored in .git/
, so removing it should work just fine. Of course, make sure that your working copy is in the exact state that you want it, because everything else will be lost. .git
folder is hidden so make sure you turn on the "Show hidden files, folders and disks" option.
From there, you can run git init
to create a fresh repository.
rm -rf .git
should suffice. That will blow away all Git-related information.
In addition to the steps below, you may want to also remove the .gitignore file.
Consider removing the .gitignore file if you want to remove any trace of Git in your project.
** Consider leaving the .gitignore file if you would ever want reincorporate Git into the project.
Some frameworks may automatically produce the .gitignore file so you may want to leave it.
Linux, Mac, or Unix based operating systems
Open a terminal and navigate to the directory of your project, i.e. - cd path_to_your_project
.
Run this command:
rm -rf .git*
This will remove the Git tracking and metadata from your project. If you want to keep the metadata (such as .gitignore and .gitkeep), you can delete only the tracking by running rm -rf .git
.
Windows
Using the command prompt
The rmdir
or rd
command will not delete/remove any hidden files or folders within the directory you specify, so you should use the del
command to be sure that all files are removed from the .git
folder.
Open the command prompt
Either click
Start
thenRun
or hit the key and r at the same time.Type
cmd
and hit enter
Navigate to the project directory, i.e. -
cd path_to_your_project
Run these commands
del /F /S /Q /A .git
rmdir .git
The first command removes all files and folder within the .git
folder. The second removes the .git
folder itself.
No command prompt
Open the file explorer and navigate to your project
Show hidden files and folders - refer to this article for a visual guide
In the view menu on the toolbar, select
Options
In the
Advanced Settings
section, findHidden files and Folders
under theFiles and Folders
list and selectShow hidden files and folders
Close the options menu and you should see all hidden folders and files including the
.git
folder.Delete the
.git
folder Delete the.gitignore
file ** (see note at the top of this answer)