I\'d like a recipe for finding duplicated changes. patch-id is likely to be the same but the commit attributes may not be.
This seems to be an intended use of patch-
I have a draft that works on a toy repo, but as it keeps the patch->commit map in memory it might have problems on large repos:
# print commit pairs with the same patch-id
for c in $(git rev-list HEAD); do \
git show $c | git patch-id; done \
| perl -anle '($p,$c)=@F;print "$c $s{$p}" if $s{$p};$s{$p}=$c'
The output should be pairs of commits with the same patch-id (3 duplicates A B C come out as "A B" then "B C").
Change the git rev-list command to restrict the commits checked:
git log --format=%H HEAD somefile
Append "| xargs git show" to view the commits in detail, or "| xargs git show -s --oneline" for a summary:
0569473 add 6-8
5e56314 add 6-8 again
bece3c3 comment
e037ed6 add comment again
It turns out patch-id didn't work in my original case as there were additional changes in that later commit. "git log -S" was more useful.