4

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/
B.T Anand
  • 549
  • 1
  • 13
  • 26
  • What do you mean by "doesn't work"? – choroba Oct 15 '18 at 08:06
  • it doesn't print any thing on the console. As soon as I remove the "-- myGitRepo/A/" it prints all the PR's. – B.T Anand Oct 15 '18 at 08:08
  • What output do you get when you keep the path but remove the `--since`? Are you sure there have been any commits in the given time interval? – choroba Oct 15 '18 at 08:13
  • Surprisingly for me, it outputs the PR's(but these are not intended for the folder i specified...it brings all the PR's) when I remove the --since. Yes there have been commits in the given time interval. – B.T Anand Oct 15 '18 at 08:16
  • What happens if you specify the date in the HHHH-MM-DD format after `--since`? – choroba Oct 15 '18 at 08:19
  • please check the above edited comment....The first filter where I am trying to extract PR titles raised for a specific folder is not working. It brings all the PR's. git --git-dir=.git log --merges -- myGitRepo/A – B.T Anand Oct 15 '18 at 08:24
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/181870/discussion-between-b-t-anand-and-choroba). – B.T Anand Oct 15 '18 at 08:32

1 Answers1

5

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/
Alderath
  • 3,761
  • 1
  • 25
  • 43