Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to unversion an entire folder?

Tags:

git

I have a folder versioned in a git. I want to unversion it, that is to remove the .git meta data, how can I do this?

Thanks

like image 900
nubela Avatar asked May 30 '10 13:05

nubela


People also ask

How do I Unversion a folder in SVN?

In the latest SVN (1.7. 10), if you have TortoiseSVN Installed (1.7. 13), there is an option in the right click menu, "Unversion and Add to ignore list".

How do I Unversion a file in Git?

The . git folder is hidden, so you have to go to Organize / Folder and Search Options, Display hidden Files option, under your main folder. It should unversion it.


2 Answers

If the folder is the top level of a git repository, and you actually want to completely remove the entire git repo associated with the folder, then simply delete the (hidden) .git directory from the folder:

cd foldername rm -r .git  

If the folder is a subdirectory of a git repository, then gautier's method is the one you want:

git rm --cached -r foldername/ 
like image 96
Jeet Avatar answered Oct 01 '22 14:10

Jeet


If you want to remove the files from git, but keep them in your filesystem add the option --cached.

git rm --cached -r foldername/ 
like image 29
Gautier Hayoun Avatar answered Oct 01 '22 14:10

Gautier Hayoun