I have a folder named "code" and in that folder, I have another folder named "resume" inside the code folder. I did "git init" on both folders. How can I undo git init to the parent folder named "code"?
Asked
Active
Viewed 6,673 times
0
-
If I type "undo git init" (question title) into google search, I get [Is there a command to undo git init?](https://stackoverflow.com/questions/3212459/is-there-a-command-to-undo-git-init) as first hit, so, a tiny bit more research effort would be nice. – Andrey Tyukin May 11 '18 at 23:10
2 Answers
3
Whenever you convert a folder to git repository it's creating the .git
folder under the given folder.
Executing git init
creates a .git subdirectory in the current working directory. If you wish to use a different or subfolder use the git init <path>
instead
In order to "delete" the git repo form this folder simply remove the .git
folder
# remove the .git folder
rm -rf .git
As you can see above once you remove the .git
folder its no longer a git repo

CodeWizard
- 128,036
- 21
- 144
- 167
2
You can simply delete the .git
directory that was created in the "code" folder.
This command creates an empty Git repository - basically a .git directory with subdirectories for objects, refs/heads, refs/tags, and template files. An initial HEAD file that references the HEAD of the master branch is also created.

Nick Rolando
- 25,879
- 13
- 79
- 119