下面介绍2个命令来实现对已经track文件的忽略。
git update-index --assume-unchanged -- path/to/file # 启用忽略 git update-index --no-assume-unchanged -- path/to/file # 停用忽略
示例如下:
77 gewang@LM-SHC-00355679@13:15:19:~/test/123
=> git diff
diff --git a/f b/f
index 541d3ff..847939a 100644
--- a/f
+++ b/f
@@ -5,3 +5,4 @@ abcaaa
aaa
dfadfaa
dlfaldf
+#####
78 gewang@LM-SHC-00355679@13:15:22:~/test/123
=> git update-index --assume-unchanged f
79 gewang@LM-SHC-00355679@13:15:36:~/test/123
=> git diff
80 gewang@LM-SHC-00355679@13:15:39:~/test/123
=> git status -s
81 gewang@LM-SHC-00355679@13:15:43:~/test/123
=> echo '-------' >> f
82 gewang@LM-SHC-00355679@13:16:04:~/test/123
=> git diff f
83 gewang@LM-SHC-00355679@13:16:06:~/test/123
=> git status -s
84 gewang@LM-SHC-00355679@13:16:14:~/test/123
=> git update-index --no-assume-unchanged f
85 gewang@LM-SHC-00355679@13:17:50:~/test/123
=> git diff
diff --git a/f b/f
index 541d3ff..6b239cf 100644
--- a/f
+++ b/f
@@ -5,3 +5,5 @@ abcaaa
aaa
dfadfaa
dlfaldf
+#####
+-------
没有评论:
发表评论