Skip to content

[Question] Is it possible to see merged commits in a single merge ? #1487

@mxrch

Description

@mxrch

Hi !
Is there a way to see merged commits by a merge ?
For example, this "Merge pull request" commit : jofpin/trape@6baae24
By looking at the pull request reference (https://github.com/jofpin/trape/pull/313/commits), we can see it has merged 3 commits : 98bae53, b17c6c1 and 626bca6.

In GitPython, by having the commit object 6baae24 (the merge), I can get the first merged commit (626bca6) by looking at the commit parents, but not the two others (logical, it's how Git works).
But using the git log command, I can extract them in raw :

(Pdb) repo.git.log("6baae24^..6baae24")
"commit 6baae245691997742a51979767254d7da580eadd\nMerge: e362980 626bca6\nAuthor: Jose Pino <account@jofpin.social>\nDate:   Sun Jun 20 11:33:43 2021 -0500\n\n    Merge pull request #313 from captain-woof/typos_and_error_fixes\n    \n    Typos and error fixes\n\ncommit 626bca666b427998b2a5cf8753737425614c8a40\nAuthor: Captain Woof <captainwoof.official@gmail.com>\nDate:   Fri May 21 09:33:45 2021 +0530\n\n    Fixed the issue where user_objects module wasn't imported\n\ncommit b17c6c133e6a5a7049d28ca88faf267eb466fe65\nAuthor: Captain Woof <captainwoof.official@gmail.com>\nDate:   Fri May 21 08:59:36 2021 +0530\n\n    Fixed the 'unexpected keyword: version' issue\n\ncommit 98bae532d213b9692322fafdda1d4f9c19093bc5\nAuthor: Captain Woof <captainwoof.official@gmail.com>\nDate:   Fri May 21 08:22:38 2021 +0530\n\n    Changed 'python2' to 'python3' and os module import"

I can use a regex to parse them, but I would know if there is a more pythonic way implemented in GitPython to do this !
I didn't see ways for this in the documentation and the implemented methods. If there isn't actually a way to do this, why not adding it ?

Thank you in advance 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions