运行git status/diff 显示subproject is dirty的解决方法

命令行下运行git diff时,显示如下输出

diff --git a/.vim/bundle/bufexplorer b/.vim/bundle/bufexplorer
--- a/.vim/bundle/bufexplorer
+++ b/.vim/bundle/bufexplorer
@@ -1 +1 @@
-Subproject commit 8c75e65b647238febd0257658b150f717a136359
+Subproject commit 8c75e65b647238febd0257658b150f717a136359-dirty

出现这个问题的原因,是因为子文件夹是一个独立的git项目,且在此项目中,有修改的文件,或者没有被track 的文件。

解决的办法是进入子文件夹提交您的修改或者回滚您的修改,如果你要放弃所有修改,只需在子文件夹下运行:
git checkout .

或者,我们在运行Git status时,添加–ignore-submodules=dirty 这个参数也可以忽略子文件dirty的问题

git status --ignore-submodules=dirty

如你喜欢以上内容,可以关注微信公众号:Robert的书签

猜你喜欢

转载自blog.csdn.net/zengjianze/article/details/105481869