title: How can I uniquely identify a git repository
body: <p>I would like to create a tool that checks if I already have a local clone of a remote repository before cloning said repository.   To do this, I need a way of testing if B is the same as repository A -- by which I guess i mean they have mergeable histories.    B might be named differently than A, and might have additional branches  -- the usual use cases.</p>
  
  <p>Is  there a way to do this?  I have a tentative idea how to do it, but I thought perhaps someone here has a definitive answer. </p>
  
  <h1>Tentative idea</h1>
  
  <p>Get a list of branches and search for common branches (by hash).  Then for the common branches, check that the initial commits are the same (by hash).  At that point I would say 'good enough'.  I figure I'm okay unless someone has been messing with history, which use-case I'm willing to neglect.  To do this though, I need a way of getting the branch and commit information from the remote repository, without doing a clone.  I can solve this using ssh &amp; bash, but a git-only solution would be preferable.</p>
  
  <p>Feedback on the half-baked idea is also welcome.</p>
  
  <h1>Why this is not a duplicate of <a href="https://stackoverflow.com/questions/4993635/git-repository-unique-id">Git repository unique id</a></h1>
  
  <p>The referenced question is looking for a unique repository id, or a way of creating one.  No such beast exists, and even if it did, it is questionable if it would be relevant here, since I want to determine if two repositories have mergeable histories (i.e. I could fetch and merge between the two) -- a slightly better defined problem.  I'm willing to ignore the possibilty that a user has modified history, but would love to hear how to handle that case as well.</p>