I created a git repository with git init
. I'd like to delete it entirely and init a new one.
While there is no undo git init command, you can undo its effects by removing the . git/ folder from a project. You should only do this if you are confident in erasing the history of your repository that you have on your local machine.
In order to delete files recursively on Git, you have to use the “git rm” command with the “-r” option for recursive and specify the list of files to be deleted. This is particularly handy when you need to delete an entire directory or a subset of files inside a directory.
Git keeps all of its files in the .git
directory. Just remove that one and init again.
If you can't find it, it's because it is hidden.
In Windows 7, you need to go to your folder, click on Organize on the top left, then click on Folder and search options, then click on the View tab and click on the Show hidden files, folders and drives radio button.
On a Mac OS:
Open a Terminal (via Spotlight: press CMD + SPACE, type terminal
and press Enter) and run:
defaults write com.apple.finder AppleShowAllFiles 1 && killall Finder
Note: The keyboard shortcut to show hidden files in Finder is CMD + SHIFT + . so it is no longer necessary to modify the finder config this way
You could also type cd
(the space is important), drag and drop your git repo folder from Finder to the terminal window, press return, then type rm -fr .git
, then return again.
On Ubuntu, use shortcut Ctrl + H.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With