簡體   English   中英

快速從git存儲庫中刪除所有文件

[英]Quickly remove all files from a git repository

在存儲庫中,我有很多不必要的文件,我想從存儲庫中刪除這些文件,僅將其保存在本地。 我了解這是通過以下方式完成的:

git rm --cached a_file

...或使用-r (如果它是文件夾)。

現在,刪除所有內容並添加一些我需要的文件變得更加容易。 如果我使用* ,當給定的文件不在倉庫中,而是在相同的本地文件夾中時,git會正確地抱怨。

我應該如何進行?

編輯:使用-f標志將不起作用:

$ git rm --cached -fr *
fatal: pathspec 'somefile' did not match any files

git rm--ignore-unmatch標志完全--ignore-unmatch我的要求。

$ git rm --cached bla
fatal: pathspec 'bla' did not match any files
$ git rm --cached --ignore-unmatch bla
$

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM