What's the difference between git diff and gif diff-index

前端 未结 2 599
别那么骄傲
别那么骄傲 2021-02-18 21:19

When I want to get git diff files, I found someone use

git diff-index --cached  --diff-filter=AM --name-only  HEAD

and if I use



        
2条回答
  •  悲&欢浪女
    2021-02-18 21:41

    diff-index is a lower level operation that does less but is much faster because it doesn't look at the content, it only checks metadata like timestamps. Only Linux you can verify this with something like:

      strace -f -e file -o diff-index.log git diff-index HEAD
      wc diff-index.log
      less diff-index.log
    

    Forget about diff-index unless you have some git performance problem to solve.

    https://git-scm.com/docs/git-update-index#_using_assume_unchanged_bit

    https://public-inbox.org/git/loom.20160331T143733-916@post.gmane.org/

提交回复
热议问题