Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
256 views
in Technique[技术] by (71.8m points)

Git: can I suppress listing of 'modified content'/dirty submodule entries in status, diff, etc?

Somewhen (around the 1.6.x releases, I think) git became aware of changes inside submodules. That only serves to annoy me:

$ git status vendor | grep modified:
#       modified:   vendor/rails (modified content)
$ git diff vendor/
diff --git a/vendor/rails b/vendor/rails
--- a/vendor/rails
+++ b/vendor/rails
@@ -1 +1 @@
-Subproject commit 046c900df27994d454b7f906caa0e4226bb42b6f
+Subproject commit 046c900df27994d454b7f906caa0e4226bb42b6f-dirty

Please make it stop?

Edit:

Ok, so I have an answer. Now I have another question:

Can I put this in ~/.gitconfig? From my initial it appears that I cannot, and I didn't see anything promising by skimming the patch. (I guess I can still make an alias.)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There is even a possibility to set the ignore mode for every added submodule within the .gitmodules file.

Just today I encountered this problem and immediately wrote an article in my blog about it after finding a solution: How to ignore changes in git submodules

The gist of it:

Once you added a submodule there will be a file named .gitmodules in the root of your repository

Just add one line to that .gitmodules file:

[submodule "bundle/fugitive"]
    path = bundle/fugitive
    url = git://github.com/tpope/vim-fugitive.git
    ignore = dirty

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...