Get Commits with Key Words

2

I'm trying to mine some data from Git, I need to know how many commits the X file is in, and if I have any keyword in a list. I am using the following command:

git log --all --grep fix --follow Freak.php

Currently it only searches for the keyword fix , it is necessary to make it possible to search for more than one keyword in the command, for example, fix OR error . How can I do this?

PS1: I've seen about the command git grep , it does not help me, because it returns a pretty messy result, I need something cleaner to capture with Symfony Process.

PS2: Since I'm using Symfony Process, I've tried to put a foreach to run the X command by changing the keyword every time I run, but the process slows down.

    
asked by anonymous 03.10.2017 / 19:16

1 answer

1

According to the documentation of git --grep to a command --or

Documentation: link

The usage would look like this:

git log --all --grep 'fix' --or 'SEGUNDASTRING' --follow Freak.php

As quoted on the blog: link

This blog contains several other forms of filtering.

But for your problem you need to keep the log command, then your solution would be:

git log --all --grep='fix' --grep='commit' --follow Freak.php
    
03.10.2017 / 20:01