How to fully delete a git repository created with

2020-01-22 13:49发布

I created a git repository with git init. I'd like to delete it entirely and init a new one.

标签: git git-init
23条回答
做自己的国王
2楼-- · 2020-01-22 13:57

Windows cmd prompt: (You could try the below command directly in windows cmd if you are not comfortable with grep, rm -rf, find, xargs etc., commands in git bash )

Delete .git recursively inside the project folder by the following command in cmd:

FOR /F "tokens=*" %G IN ('DIR /B /AD /S .git') DO RMDIR /S /Q "%G"

查看更多
smile是对你的礼貌
3楼-- · 2020-01-22 13:59

If you really want to remove all of the repository, leaving only the working directory then it should be as simple as this.

rm -rf .git

The usual provisos about rm -rf apply. Make sure you have an up to date backup and are absolutely sure that you're in the right place before running the command. etc., etc.

查看更多
Juvenile、少年°
4楼-- · 2020-01-22 13:59

true,like mine was stored in USERS,so had to open USERS go to View on you upper left find Options,open it and edit folders'view options in view still to display hidden files/folders,all your folders will be displayed and you can deleted the repo manually,remember to hide the files/folders once done with the delete.

查看更多
The star\"
5楼-- · 2020-01-22 14:00

I did this, and it worked just fine.
1. Remove the .git file from the repo by rm -fr .git
2. Remove the repo folder by rm -R path\your_repo_name

查看更多
爱情/是我丢掉的垃圾
6楼-- · 2020-01-22 14:01

In windows:

  1. Press Start Button
  2. Search Resource Monitor
  3. Under CPU Tab -> type .git -> right click rundll32 and end process

Now you can delete .git folder

查看更多
我想做一个坏孩纸
7楼-- · 2020-01-22 14:02

If you want to delete all .git folders in a project use the following command:

find . -type f | grep -i "\.git" | xargs rm

This will also delete all the .git folders and .gitignore files from all subfolders

查看更多
登录 后发表回答