Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do Git Log see only merges to master branch?

Tags:

git

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 ?

like image 884
WonderLand Avatar asked Sep 23 '14 03:09

WonderLand


People also ask

What happens when you run git log -- merges in your master branch?

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.

How do I limit a git log?

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.

How do you check if branches are merged?

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.

What is git log -- Oneline?

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.


2 Answers

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} 
like image 152
Andrew C Avatar answered Sep 20 '22 11:09

Andrew C


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

like image 22
Ricardo de Cillo Avatar answered Sep 16 '22 11:09

Ricardo de Cillo