整个计算机处于Git状态,未跟踪文件 [英] Entire computer in Git status untracked files
问题描述
我是git的新手,我认为我不小心将其克隆到了根目录中.当我提交一个文件(index.html)时,我注意到整个计算机(台式机,文档等)都位于未跟踪的文件中.我删除了存储库,我想删除所有未跟踪的文件,显然没有删除计算机中的所有内容.我对丢失文件感到陌生.
I'm new to git and I think I accidentally cloned in the root directory. When I committed one file (index.html) I noticed my whole computer (my desktop, my documents, etc) all in untracked files. I deleted the repository and I want to remove all the untracked files, obviously without deleting everything from my computer. I am new and paranoid about losing my files.
推荐答案
您必须已运行
git init
某处.您需要找到运行它的文件夹.只需运行:
somewhere. You need to find the folder you ran this in. Just run:
git status
您认为现在在git控制"下的某个位置,您会通过以下路径看到:如果您有类似Desktop/myFolder的路径,请说=>您知道包含桌面的文件夹是git根文件夹.只需浏览并运行:
somewhere you think is now under git "control" and you'll see by the paths: say if you have a path like Desktop/myFolder => you know the folder that contains desktop is you git root folder. Just navigate there and run :
rm -r .git
所有都应该恢复正常:)
And all should be back to normal :)
现在,我们得到了状态输出:) ..好了,您可以看到这件事的根源是您的主文件夹.因此,只需执行以下操作:
Now that we got the status output :) .. Alright as you can see the root of this thing is you home folder. So just do this:
-
移动到主文件夹
move to the home folder
cd ~
删除git仓库
delete the git repo
rm -rf .git
=> git repo肯定没有了:)
=> git repo is gone for sure :)
这篇关于整个计算机处于Git状态,未跟踪文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!