如何从 TortoiseGit 中删除本地 Git 存储库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10259477/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 06:48:15  来源:igfitidea点击:

How to remove a local Git repo from TortoiseGit?

gittortoisegit

提问by siegi

I started messing around with Git today. I think I've done something wrong because when I installed TortoiseGit it looks like a lot of folders in my C and F (second partition) have a green tick next to them (meaning the file is commited? I think?). What can I do to remove these ticks. Is there a way to NOT delete the actual files/folders but just a file or two that tells Windows to add a green tick to the icon? I'm a bit scared working with stuff like that on my C:. In other words - is there a way to undo the "init" action?! Please see image here http://i.stack.imgur.com/pKa1o.png

我今天开始玩弄 Git。我想我做错了什么,因为当我安装 TortoiseGit 时,看起来我的 C 和 F(第二个分区)中的很多文件夹旁边都有一个绿色的勾(意味着文件已提交?我想?)。我该怎么做才能去除这些蜱虫。有没有办法不删除实际的文件/文件夹,而只删除一两个文件,告诉 Windows 在图标上添加绿色勾号?我有点害怕在我的 C: 上使用这样的东西。换句话说 - 有没有办法撤消“init”操作?!请在此处查看图片http://i.stack.imgur.com/pKa1o.png

I'm new to Git so sorry for non professional vocab in this question. Thanks.

我是 Git 的新手,对于这个问题中的非专业词汇感到抱歉。谢谢。

回答by siegi

Don't know about TortoiseGit but the git initcommand simply creates a (hidden) .gitdirectory in the root of the repository and fills it with some needed files. So to undo an init all you need to do is to delete this .gitdirectory. Note that some files in this directory can be write protected, so a warning dialog can appear. Please also note that all commits you have made in this repository will be lost (which should be no problem in your case).

不知道 TortoiseGit,但该git init命令只是.git在存储库的根目录中创建一个(隐藏)目录,并用一些需要的文件填充它。因此,要撤消 init,您需要做的就是删除此.git目录。请注意,此目录中的某些文件可以写保护,因此可能会出现警告对话框。另请注意,您在此存储库中所做的所有提交都将丢失(在您的情况下应该没有问题)。

However I don't know if this works or is enough when using TortoiseGit…

但是我不知道在使用 TortoiseGit 时这是否有效或是否足够......

回答by ekatomi kaotifa

Remove the .git folder in your repository.

删除存储库中的 .git 文件夹。

回答by Narasimha Reddy

open git bash then execute below command

打开 git bash 然后执行下面的命令

$ rm -rf .git

$ rm -rf .git