如何添加和提交用“rm”创建的删除而不是“git rm”? [英] How to add and commit removals made with "rm" instead of "git rm"?
本文介绍了如何添加和提交用“rm”创建的删除而不是“git rm”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 rm
,Finder等从Git存储库中删除了一堆文件和目录。
I deleted a bunch of files and directories from a Git repository using rm
, the Finder, etc.
我正在寻找一个Git命令,它会将这些记录记录到标记为删除的索引中,就像我对它们调用了 git rm
一样。
I'm looking for a Git command that'll record these to the index as marked for removal, as if I had called git rm
on them.
我知道 git add -u
会执行此操作以及其他一些操作。
I understand git add -u
will do this, along with a bunch of other things. I'd like my command to exclusively handle removals.
推荐答案
不带空格的文件名:
$ git rm `git ls-files -d`
更强大:
More robust:
$ git ls-files -z -d | xargs -0 --no-run-if-empty git rm
这篇关于如何添加和提交用“rm”创建的删除而不是“git rm”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文