ignoring changes matching a string in git diff

前端 未结 4 1280
不思量自难忘°
不思量自难忘° 2020-12-08 06:53

I\'ve made a single simple change to a large number of files that are version controlled in git and I\'d like to be able to check that no other changes are slipping into thi

4条回答
  •  粉色の甜心
    2020-12-08 07:42

    I think that I have a different solution using pipes and grep. I had two files that needed to be checked for differences that didn't include @@ and g:, so I did this (borrowing from here and here and here:

    $ git diff -U0 --color-words --no-index file1.tex file2.tex | grep -v -e "@@" -e "g:"
    

    and that seemed to do the trick. Colors still were there.

    So I assume you could take a simpler git diff command/output and do the same thing. What I like about this is that it doesn't require making new files or redirection (other than a pipe).

提交回复
热议问题