Comparing Two Repositories with different parents

Viewed 35

I don't know if parents was the correct term to use, but I have two repositories in Git. One is located in git.company.com/team and one is located in git.company.com/user. The repository in the user location had been forked from the team location, but when the team version was changed from public to private the fork was removed. I'm not sure which repository has the latest code and I don't know how to compare them since the user repository is no longer forked from the team repository. Is there a way I can compare these two or link them back together?

1 Answers

Yes, make one a remote of the other.

git remote add team git@git.company.com/team.git
git fetch team

Now you will have the team repository as the remote "team", just like "origin". Its main branch is team/main. You can check the differences with git diff main team/main and look at new commits with git log main...team/main (or vice versa).

See Working With Remotes for more.

Related