Search code examples
gitgithubbitbucketgit-diffgit-difftool

Git - Get the difference between branches of two repositories


How can we get the list of files differences between two branches residing in two separate repositories

Scenario: Suppose we have 2 repositories 'A' & 'B', B was created from A since A is the base repo. Now the development work has been taking place since long on both this repositories 'A' with branch 'support/v1' and 'B' with branch 'master'. I want to find and check which files are missing with 'B'. In short need an list of files difference between branches of this two repo.

repo  branches
A   => support/v1
B   => master

Need help to find the list of files using git


Solution

  • Add both repos as a remote in your local repository and then run diff like you would for any other branches:

    git clone pathorurl/to/A.git
    cd A
    git remote add B pathorurl/to/B.git
    git fetch --all
    git diff origin/support/v1 B/master
    

    This will work for any two repositories, because git diff only looks at tree objects and is not interested in commit history.