Thread: How do I compare cloned github projects?

  1. #1
    Registered User
    Join Date
    Nov 2009
    Location
    Maryland, USA
    Posts
    46

    How do I compare cloned github projects?

    Github makes it very easy to clone an existing project so you can make your own version the way you want to. But I don't see any way to easily compare a project to a clone to see what's different.

    Consider these two projects as an example:
    github.com/offbytwo/git-hg and
    github.com/cosmin/git-hg.

    I could clone them both locally and do a file-by-file compare, but for big projects that would be laborious. Does anyone have any trick or insight for a quicker solution?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I think you pretty much have to clone locally at least (in the absence of any nice github tool to do it for you).
    Having cloned, you could do "git log --oneline > file.txt" to compare commit history, which would also show you the common ancestor (unless the clone completely scrubbed the old history).

    From there, you could then do something like "git log --name-only ancestor..HEAD" to tell you all the files which have changed since the split. This too you could direct to a file, and diff to find files changed on both branches.

    kdiff3 can recursively compare two directory trees and easily filter out common files.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    I dont think it is possible to perform this without cloning one repo locally. However you can do the following:
    Code:
    git clone https://github.com/cosmin/git-hg.git
    cd git-hg
    git remote add offbytwo https://github.com/offbytwo/git-hg.git
    git fetch offbytwo
    git diff offbytwo/master
    This will show you the difference between the master branch cloned from cosmin and the master branch from offbytwo. I would also suggest to use something like qgit for a nice visual representation of the branch trees and so on. This will quickly show you the common ancestor and so on.
    Last edited by Shakti; 06-09-2013 at 10:45 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to compare, without using compare (homework)
    By Mr.777 in forum C++ Programming
    Replies: 8
    Last Post: 03-07-2011, 02:55 AM
  2. Replies: 7
    Last Post: 10-20-2010, 11:25 PM
  3. compare with chars && compare with int
    By zcrself in forum C Programming
    Replies: 1
    Last Post: 04-22-2010, 03:19 AM
  4. Replies: 11
    Last Post: 05-25-2007, 04:39 PM
  5. Human embryo cloned
    By BobMcGee123 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 06-20-2005, 08:31 PM

Tags for this Thread