Replies: 1 comment 1 reply
-
Temporary solution to extract hexsha of merged commits : for commit in repo.iter_commits():
if len(commit.parents) > 1:
merged_commits = re.findall(r'\S{40}', repo.git.log(f"{commit.hexsha}^..{commit.hexsha}"))[1:] |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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 thecommit
parents, but not the two others (logical, it's how Git works).But using the git log command, I can extract them in raw :
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 😄
Beta Was this translation helpful? Give feedback.
All reactions