Getting the difference between two repositories

后端 未结 11 1193
梦如初夏
梦如初夏 2020-11-30 16:33

How can we get the difference between two git repositories?

The scenario: We have a repo_a and repo_b. The latter was created as a copy of repo_a. There have been pa

相关标签:
11条回答
  • 2020-11-30 17:11

    Meld can compare directories:

    meld directory1 directory2
    

    Just use the directories of the two git repos and you will get a nice graphical comparison:

    When you click on one of the blue items, you can see what changed.

    0 讨论(0)
  • 2020-11-30 17:14

    Your best bet is to have both repos on your local machine and use the linux diff command with the two directories as parameters:

    diff -r repo-A repo-B

    0 讨论(0)
  • 2020-11-30 17:14

    Reminder to self... fetch first, else the repository has not local hash (I guess).

    step 1. Setup the upstream remote and above^

    diffing a single file follows this pattern :

    git diff localBranch uptreamBranch --spacepath/singlefile

    git diff master upstream/nameofrepo -- src/index.js

    0 讨论(0)
  • 2020-11-30 17:17

    An easy way to do that without touching your remotes config. From repo A, in master (assume you want to compare master branches):

    git fetch path/to/repo_b.git master
    git diff FETCH_HEAD
    
    0 讨论(0)
  • 2020-11-30 17:22

    Once you have both branches in one repository you can do a git diff. And getting them in one repository is as easy as

    git fetch /the/other/repo/.git refs/heads/*:refs/remotes/other/*
    
    0 讨论(0)
提交回复
热议问题