我的 Git 存储库中有大量事件文件。我所做的一项更改是删除多个目录中的大量图像。我想立即提交更改,但我不想包含所有事件文件,也不想为每个图像手动键入 git rm myfile.png
。
基本上我想做的是对所有以 .png
结尾的事件文件运行 git rm
。我试图通过将 git status
的结果传送到 git rm
中来实现这一点,但我在隔离文件名并使其正常工作时遇到了问题喜欢。
这是对管道的正确使用吗?如果是,我需要什么语法?
感谢任何帮助,谢谢。
最佳答案
如果您已经删除了这些文件,您可以键入:
git add -u
并且它们将从 git 存储库中删除。
来自git help add
:
-u, --update
Only match <filepattern> against already tracked files in the index
rather than the working tree. That means that it will never stage
new files, but that it will stage modified new contents of tracked
files and that it will remove files from the index if the
corresponding files in the working tree have been removed.
关于linux - 将 git status 的结果通过管道传递给后续命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11419698/