25

Short version

When I compare two forks on Github, it does not compare the latest states, but the current state of the base fork with the last common commit (or am I wrong?); so how can I compare the latest states/heads on Github?

Longer version

I am trying to compare two repositories on Github.

It does not seem to compare the latest states of both repository. Instead, it compares:

  • the base fork as it was when both repositories where identical (last common commit?)

with

  • the head fork as it is now.

You can see this in the Github's fork comparison example, it says there are no changes between those two repositories, but there are now very different.

How can I compare the latest states/heads on Github?

arthur.sw
  • 11,052
  • 9
  • 47
  • 104

2 Answers2

26

https://github.com/github/linguist/compare/master...gjtorikian:master

github:master is up to date with all commits from gjtorikian:master.
Try switching the base for your comparison.

It means that all commits from gjtorikian/liguist are part of github/linguist.

The reverse is not true:
https://github.com/gjtorikian/linguist/compare/master...github:master

That would give all (1866) commits from github/linguist which are not part of gjtorikian/linkguist.

This is triple-dot '...' diff between the common ancestor of two branches and the second branch (see "What are the differences between double-dot “..” and triple-dot “” in Git diff commit ranges?"):

git diff double and triple dots

In the first case github/linguist:master...gjtorikian/linguist:master, the common ancestor and gjtorikian/linguist:master are the same! O commits.

In the second case gjtorikian/linguist:master...github/linguist:master, github/linguist:master has 1866 commits since the common ancestor (here, since gjtorikian/linguist:master).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Ah ok! So one must know which repo is the newest before comparing? – arthur.sw Aug 11 '15 at 10:53
  • @arthur.sw yes, or you can switch in case of empty result: if the switch is not empty, you know which one is newer, and which one is older. If the switch is empty, both are identical. – VonC Aug 11 '15 at 10:54
  • Thanks! I did not pay attention to this switch before :-) – arthur.sw Aug 11 '15 at 10:55
  • 1
    @arthur.sw as you can see in http://stackoverflow.com/a/7256391/6309 (similar to log with http://stackoverflow.com/a/24186641/6309), the '...' diff has different result depending on the order. – VonC Aug 11 '15 at 10:58
21

As a side note, the compare of forks can be reached from the compare page.

Say your project is Zipios:

https://github.com/Zipios/Zipios

What you want to do is add the .../compare to that URL:

https://github.com/Zipios/Zipios/compare

On that page, you can select two branches but if you look closely, at the top there is a link that says: compare across forks.

Once you clicked on that link, it shows you two extra dropdowns with your main branch and the list of forks.

What I have yet to discover is how to go from the main page of a project to the Compare page. Maybe someone could shed light on that part?


From @somerandomdev49:

To go to the compare page, go to the "Pull Requests" tab and click the "Create Pull Request" button.

Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156
  • 2
    To got to the compare page, got to the "Pull Requests" tab and click the "Create Pull Request" button – somerandomdev49 Oct 11 '21 at 19:06
  • @somerandomdev49 Oh! That is worth its own answer. That's the actual solution. Of course, clicking on "New Pull Request" (not "Create ...") is not intuitive... – Alexis Wilke Oct 11 '21 at 19:10