gpt4 book ai didi

git - 删除 'changes not staged for commit` 中的文件

转载 作者:太空狗 更新时间:2023-10-29 13:28:31 25 4
gpt4 key购买 nike

这是我的 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com