Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Git repository, but keep all files

Tags:

git

linux

At some point during my adventures with Linux, I decided that it would be a good idea to put everything in my home directory into source control. I'm not asking whether that was a good idea or not -- I'm asking how to undo it.

The reason for removing the repository is that I recently installed Oh My Zsh, and I really like it. The rub is that my home directory has a big git:(master) stuck behind it, and I'm just not a huge fan of that.

enter image description here

So what I would like to do is remove the git repository itself, so that the git:(master) is no longer displayed, without deleting all of my files.

like image 630
Linell Avatar asked Apr 01 '14 20:04

Linell


2 Answers

Just remove (or rename) the .git subdirectory. That subdirectory is the whole of the repository. This will not delete your files, but it will delete their history.

Additionally, there might be files like .gitignore and .gitattributes that are not necessary anymore.

Make sure that all your files are present in the working tree before removing/renaming .git.

like image 102
Roland Smith Avatar answered Sep 22 '22 15:09

Roland Smith


Your repository resides in the .git directory, you can delete it easily. But if only the prompt disturbs you, it is enough to search where PROMPT gets new value in your environment and modify it to something else.

like image 33
Lajos Veres Avatar answered Sep 19 '22 15:09

Lajos Veres