0

Background

I have a repo that was duplicated, rather than forked, from another repo. This was done because the duplicated repo needs to be private whereas the parent repo is public, and Github does not permit a fork of a public repo to be made private.

(Note: the duplicate was created according to Github's docs here.

My goal

The duplicated repo will have independent work done on it. I wish to compare the parent repo with the duplicated one so that desired changes to the parent can be integrated with the duplicate. For convenience, I wish to use Github's /compare view rather than a local difftool.

The problem

Github's cross-repo /compare view appears to only work when the repos are forks of one another. The URL syntax indicated by Github's docs is: https://github.com/user1/repo/compare/branch...user2:branch

When I try to use the same URL syntax with the duplicate to compare both master branches, I get the error There isn’t anything to compare. The drop-down menus for head and base repo do not list the parent (and if I use /compare on the parent, do not list the duplicate) and are not editable. My guess is that this is because the duplicate was not forked, but duplicated.

Question

Is there a way to make the Github /compare view work with a duplicated repo, as opposed to a forked one? For example, is there a git config setting that can be changed to make it appear as a fork, an alternative URL syntax, etc etc.

Or alternatively, is there a way to accomplish my goal of comparing the parent and child repos if some other means of creating the child repo (as opposed to duplication) is used, with the proviso that the child must be able to be made private?

Additional note

I am able to successfully diff the repos locally via the remote config and commands in this question, but being able to compare on Github itself would be much better for my team.

All guidance is much appreciated!

Mister October
  • 165
  • 1
  • 9

1 Answers1

1

You can only use the GitHub /compare view to view repositories in the same repository network. If the two repositories have different visibility (one is public and the other is private), then by definition they cannot be in the same repository network, and that functionality will not work.

The reason that's required is that in order to do a diff, you may need objects from both repositories to compute the diff. Two repositories in the same network (that is, with the same main repo and fork set) share underlying storage on disk and all objects are available. Repositories that are not do not, and it wouldn't be possible to compute the diff without creating a temporary repository with data with both repositories, much like would be the case if the public and private repositories you were working with were cloned separately on disk.

bk2204
  • 64,793
  • 6
  • 84
  • 100