Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 72689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:05:02+00:00 2026-05-10T20:05:02+00:00

This is sort of a follow-up to this question . If there are multiple

  • 0

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 will be identical. How would one go about finding all duplicate files for a given tree?

Would you have to walk the tree and look for duplicate hashes, or does git provide backlinks from each blob to all files in a tree that reference it?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T20:05:03+00:00Added an answer on May 10, 2026 at 8:05 pm

    Running this on the codebase I work on was an eye-opener I can tell you!

    #!/usr/bin/perl  # usage: git ls-tree -r HEAD | $PROGRAM_NAME  use strict; use warnings;  my $sha1_path = {};  while (my $line = <STDIN>) {     chomp $line;      if ($line =~ m{ \A \d+ \s+ \w+ \s+ (\w+) \s+ (\S+) \z }xms) {         my $sha1 = $1;         my $path = $2;          push @{$sha1_path->{$sha1}}, $path;     } }  foreach my $sha1 (keys %$sha1_path) {     if (scalar @{$sha1_path->{$sha1}} > 1) {         foreach my $path (@{$sha1_path->{$sha1}}) {             print '$sha1  $path\n';         }          print '-' x 40, '\n';     } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is sort of a follow-up to my original question here . Let's
This question is a (sort of) follow-up to Intercepting/Rerouting TCP SYN packets to C++
So this question is a sort of follow on from here ( how to
This is sort of a follow on from my last question. I am using
This is sort of a follow up to my last question. Im trying to
As sort of a follow up to this previous question: Normalizing a variety of
This is sort of a follow-up to this question . I want to know
This is a follow up of this excellent question C# Sort and OrderBy comparison
I know that this sort of question has been asked here before, but still
I have this sort of format asp.net MVC View -> Service Layer -> Repository.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.