Chinaunix首页 | 论坛 | 博客
  • 博客访问: 163332
  • 博文数量: 22
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 248
  • 用 户 组: 普通用户
  • 注册时间: 2014-08-05 19:05
文章分类
文章存档

2018年(12)

2017年(10)

我的朋友

分类: Android平台

2018-03-09 11:23:39

1、代码库文件test.txt文件如下

 
testgitgrep=1
testlinuxgrep=0

把testgitgrep=1改成testgitgrep=0后

 
testgitgrep=0
testlinuxgrep=0

2、

用git grep搜索,结果如下

test@ubuntu:~$git grep 'test' test.txt
test.txt:testgitgrep=1 (这里已经改成0了,为什么搜出来的结果还是1
test.txt:testlinuxgrep=0

用grep搜索,结果如下

test@ubuntu:~$grep 'test' test.txt
testgitgrep=0
testlinuxgrep=0

而且用git diff也没有输出

test@ubuntu:~$git diff test.txt

3、为什么git grep搜索结果错误,原来是设置了git update-index --assume-unchanged,把他设置回去git update-index --no-assume-unchanged,如下

git update-index --no-assume-unchanged test.txt

现在git diff就有输出了,而且git grep搜出来的结果也和grep一致。

git diff test.txt
diff --git a/test.txt b/test.txt
index 27e64ff..3e4920f 100644
--- a/test.txt
+++ b/test.txt
@@ -1,2 +1,2 @@
-testgitgrep=1
+testgitgrep=0
 testlinuxgrep=0
test@ubuntu:~$git grep 'test' test.txt
test.txt:testgitgrep=0
test.txt:testlinuxgrep=0
阅读(1931) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~