Git: Find duplicate blobs (files) in this tree

后端 未结 6 2027
长发绾君心
长发绾君心 2021-02-04 03:32

This is sort of a follow-up to this question.

If there are multiple blobs with the same contents, they are only stored once in the git repository because their SHA-1\'s

6条回答
  •  南笙
    南笙 (楼主)
    2021-02-04 04:34

    Just made a one-liner that highlights the duplicates rendered by git ls-tree.
    Might be useful

    git ls-tree -r HEAD |
        sort -t ' ' -k 3 |
        perl -ne '$1 && / $1\t/ && print "\e[0;31m" ; / ([0-9a-f]{40})\t/; print "$_\e[0m"'
    

提交回复
热议问题