EN VI

Git log of a specific branch already merged?

2024-03-12 23:00:07
How to Git log of a specific branch already merged

I'm trying to update a documentation script in Python, as my coworkers and I have recently started working with GIT.

The point I'm at and stuck with now is trying to extract a list of the names of modified files in a branch via os.system(..). Is there any way to get a list with the names of the modified files in a branch if it has already been merged into another branch? Thanks in advance!

When I try to use a "git log --name-only --pretty=format: <feature_branch>", I get the feature_branch names of the files modified, but also the ones from the parent branch, which is the master_branch from which it was created, giving me not only the files we've been working with in the branch, but the whole history, which I'm not interested in.

I've also tried doing a "git log --name-only --pretty=format: <master_branch>..<feature_branch>", but the list comes up empty, and from what I've read, this could be because the feature_branch is already merged over the master_branch.

Solution:

Is there any way to get a list with the names of the modified files in a branch if it has already been merged into another branch?

Find the merge, then git diff --name-only $merge^1...$merge^2. See the three-dot ... syntax in the git diff docs

Answer

Login


Forgot Your Password?

Create Account


Lost your password? Please enter your email address. You will receive a link to create a new password.

Reset Password

Back to login