这是我的 git 状态:
# On branch create-views-question
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: solr/data/development/index/_0.fdt
# deleted: solr/data/development/index/_0.fdx
# deleted: solr/data/development/index/_0.fnm
# deleted: solr/data/development/index/_0.frq
...
目前,我使用 git rm
一个一个地删除文件,有没有其他方法可以同时删除它们?
最佳答案
在这种情况下你可以这样做
git rm 'solr/data/development/index/_0.*'
注意 '
标记以防止 shell 扩展,而是将 *
直接传递给 git。
这是一个例子:
graphite> git status
# On branch master
# Changes not staged for commit:
# deleted: a
# deleted: b
#
no changes added to commit
graphite> git rm '*'
rm 'a'
rm 'b'
graphite> git status
# On branch master
# Changes to be committed:
# deleted: a
# deleted: b
#
关于git - 删除 'changes not staged for commit` 中的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13203008/