tags:

views:

51

answers:

1

Say someone clones repository A which results in repository B and then I clone repository B, is there a way to determine what the upstream repository (i.e. repository A) is? I know that github shows the 'forked from blah/blah' but I'm not using github for this project.

The reason I ask is that I'd like to get all the changes that the person made in a single diff file.

In subversion I could just do svn log --stop-on-copy to get the first commit and then svn diff -rXXXX:HEAD where XXXX is the first revision of the branch to get a diff with all the changes. I know that branching and cloning aren't quite the same thing but I wanted to provide what I was after ultimately. Doing a diff on the upstream repo and the cloned repo seemed the way to go but I might be wrong.

Thanks in advance.

+5  A: 

Simply, no. The 'upstream' repository (if a repository even has a single upstream) is determined only by a repository's config settings and even these could in theory be inaccurate if the upstream maintainer just does explicit fetches from different repositories, ignoring the configured default.

If you have shell (or file system) access to the remote repository then you can query the config file or output of git config (try remote.origin.url) but otherwise it's not part of the standard 'upload pack' protocol.

Even without knowledge of the remote repository you may be able to figure out what commits a particular set of authors/commiters have made by using git log --author or git log --committer on the fetched branches.

Charles Bailey
Bummer. I really did like being able to easily get a diff. Thanks for the answer.
seth