Skip to content

Is three a way to do three dot diff between two branches? #1426

@iwccsbfb

Description

@iwccsbfb

In command line, I can do git diff master..branch and also git diff master...branch. However, in gitPython, it seems the commit.diff(commit2) is only doing two dot diff. And I couldn't find a way to do three dot diff directly (I have searched through the document and googled around).
I am thinking to find the commit where we branch off, and then do a two way diff - this would be the same as the three way diff of two branches. But it does not work exactly as expected:

# this commit is not the root commit, but the child of the root commit...
commit = list(repo.iter_commits('origin/master..HEAD'))[-1]
diff = commit.diff(repo.head.commit)

Would you have any recommendation?
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions