On Wed, Mar 22, 2023 at 7:36 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > 3. Use `--stat` to ignore file creation time differences in unrefreshed > > index. > > I am curious about this one. Why is this a preferred solution over > say "run 'update-index --refresh' before running diff-files"? > > Note that this is merely "I am curious", not "I think it is wrong". Hi Junio Thank you for your question, it has prompted me to consider the matter further =) I think both solutions, using git diff-files --stat and using git update-index --refresh before git diff-files, can produce the same output but in different ways. When the index file is not up-to-date, git diff-files may show differences between the working directory and the index that are caused by file creation time differences, rather than actual changes to the file contents. By using git diff-files --stat, which ignores file creation time differences. While 'git update-index --refresh' updates the index file to match the contents of the working tree. By running this command before git diff-files, we can ensure that the index file is up-to-date and that the output of git diff-files accurately reflects the differences between the working directory and the index. Maybe using git update-index --refresh would be more direct and straightforward solution. (Hi Victoria, do you have any comments? =) Thanks Shuqi