Search code examples
gitgit-loggit-shell

GIT log command to extract pull request titles


I have a huge repository which has multiple folders inside it. Each of these folders is a separate application. Below is a sample of the repo structure:

myGitRepo/
 A/
 B/
 C/
 .git

I have been trying to use git log to fetch Pull request titles. However I want to filter it for a specific folder i.e "C".

Post using below command I was able to extract Pull request titles based on time:

git --git-dir=.git log --merges --since="Wed Oct 10 07:57:32 UTC 2018"

However when I try to filter these PR titles based on my folder, it doesnt work. I have used below command:

git --git-dir=.git log --merges --since="Wed Oct 10 07:57:32 UTC 2018" -- myGitRepo/A/

Solution

  • I think the issue here is that git is trying to match the condition that -- <path> needs to be modified towards both parents. If you instruct git to check only towards one of the parents, I think the command could work.

    Try the following (using --first-parent):

    git --git-dir=.git log --first-parent --merges --since="Wed Oct 10 07:57:32 UTC 2018" -- myGitRepo/A/