Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uninitialize git repository

Tags:

git

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?

like image 747
Naseer Avatar asked Mar 20 '14 17:03

Naseer


People also ask

Can I Uninitialize git repository?

Go to "File Explorer Options" in the control panel, there go to "View" and check the option that allows you to see the hidden folders. Then go to the folder where you want to un-initialize the git repository and you will find a folder called ". git" (it will be slightly faded since it's a hidden folder).

How do I un initialize a repository?

Initializing a new repository: git init To create a new repo, you'll use the git init command. git init is a one-time command you use during the initial setup of a new repo. Executing this command will create a new . git subdirectory in your current working directory.

How do I remove a git repository from VS code?

Right-click the project in the Project Explorer panel and then choose Source Control > Delete Repository from the context menu.


2 Answers

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 
like image 181
Chris Maes Avatar answered Oct 11 '22 15:10

Chris Maes


Just deleting the .git directory stored in the repository will pretty much do it.

like image 22
WeylynCadwell Avatar answered Oct 11 '22 15:10

WeylynCadwell