In my work process I need to provide a list of files to my server admin. The list comes from the merge of my working branch (Branch A) into Master branch.
So I merge branch A into branch Master and then deploy Master.
Right now the best I could do with git log
is the following but this list contains other commit as well ( not only the merge I'm looking for ):git log -m --name-only --author=[NAME]
So basically I need to retrieve the files list for the merge of Branch A
into Master Branch
Is it possible with cli command ?
For git log , the default behaviour is equal to git log HEAD where HEAD refers to the commit the current branch currently points at. So if you are on the master branch, it is equal to git log master , showing all commits that are reachable when starting at the most recent commit.
The most basic filtering option for git log is to limit the number of commits that are displayed. When you're only interested in the last few commits, this saves you the trouble of viewing all the commits in a page. You can limit git log 's output by including the - option.
You can use the git merge-base command to find the latest common commit between the two branches. If that commit is the same as your branch head, then the branch has been completely merged.
Git Log OnelineThe oneline option is used to display the output as one commit per line. It also shows the output in brief like the first seven characters of the commit SHA and the commit message. It will be used as follows: $ git log --oneline.
Narrow it down using git log --merges --author
to figure out the commit you want and then try
git diff --name-only ${MERGE_SHA}^1..${MERGE_SHA}
I find it useful to narrow the path to first parent in order to ignore "update branch" merges.
Looks like this for me:
git log r2.8.7-2018-09-04..HEAD --merges --first-parent
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With