I’m executing the following command:
git log --name-only –pretty=\"format:%H %s\" -- *.sql --grep=\"JIRA-154\"
which returns results in the
The reason you are observing this behavior is that in the case of a merge commit there are two sets of changed files, one coming from each parent. One option here would be to use the --first-parent -m options when running your git log:
git log --name-only --grep="JIRA-154" --first-parent -m –-pretty="format:%H %s" -- "*.sql"
This will tell Git to focus onlg on the main branch into which the merge is happening, showing the set of files for this commit only.
Check here for the documentation and here for a great blog post.