From: Ævar Arnfjörð Bjarmason Date: Thu, 22 Mar 2018 19:20:45 GMT Subject: Re: The most efficient way to test if repositories share the same objects Message-ID: <87o9jfyl0y.fsf@evledraar.gmail.com> In-Reply-To: <14d0937f-0e39-7af7-a395-3046ec5d5c16@linuxfoundation.org> On Thu, Mar 22 2018, Konstantin Ryabitsev wrote: > What is the most efficient way to test if repoA and repoB share common > commits? My goal is to automatically figure out if repoB can benefit > from setting alternates to repoA and repacking. I currently do it by > comparing the output of "show-ref --tags -s", but that does not work for > repos without tags. If you're using show-ref already to get the tag tips, you can use for-each-ref to get all tips. But of course that'll just give you the tips. You could then use `git cat-file --batch-check` on both ends to see what commits from the other they report knowing about, in case they have branches that are ahead/behind the other.