Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I compare two git repositories?

I've got two different exports of our CVS repository into git. They diverge at some point, and I'm doing some investigation into why. The development line goes back several years and over tens of thousands of commits.

At the beginning of the development line, the SHA1 IDs for each commit are identical, telling me that git-cvsimport is very consistent about what it is doing when it reads the results of cvsps and imports.

But sometime between the first commit and yesterday, the SHA1 IDs begin to diverge. I'd like to find out where this is by comparing a list of commit IDs from each repository and looking to see what's missing. Are there any good tools or techniques for doing this?

like image 632
skiphoppy Avatar asked Mar 26 '09 20:03

skiphoppy


People also ask

How do I compare two repositories?

Just open the parent folder for both repos and wait until it indexes. Then you can use right click on a folder or file and Compare to... and pick the corresponding folder / file on the other side. It shows not only what files are different but also their content.

How do I compare two GitHub branches?

On the Github, go to the Source view of your project. You will see a link named 'Branch List'. Once the page opens you can see a list of all the remote branches. Hit on the Compare button in front of any of the available branches to see the difference between two branches.

How do I compare Git versions?

You can run the git diff HEAD command to compare the both staged and unstaged changes with your last commit. You can also run the git diff <branch_name1> <branch_name2> command to compare the changes from the first branch with changes from the second branch.


1 Answers

Since the two git repositories start out the same, you can pull both into the same working repository.

$ git remote add cvsimport-a git://.../cvsimport-a.git $ git remote add cvsimport-b git://.../cvsimport-b.git $ git remote update $ git log cvsimport-a/master..cvsimport-b/master  # in B, not in A? $ git log cvsimport-b/master..cvsimport-a/master  # in A, not in B? 
like image 66
ephemient Avatar answered Sep 26 '22 08:09

ephemient