First step, I want to list all the diffs between two dates for a given file

git log –since=”2012-10-11″ –until=”2012-10-12″ -p README.md

Then, I want to count how many lines begin with the string “+This”.

grep -c –regexp=”+This” minp

outputs 4.

Lets assemble with the first command:

git log –since=”2012-10-11″ –until=”2012-10-12″ -p README.md | grep
-c –regexp=”+This”

Next I want to apply these commands to all files with a given name in
a tree of folders. I first want to make sure the script is working
without getting into much trouble counting strings in several files.
So I’ll pass the README.md in the current folder, using ls:

ls *md | git log –since=”2012-10-11″ –until=”2012-10-12″ -p | grep
-c –regexp=”+This”

The output is 1 as expected.

To list all the README.md files recursevly i’ll use the find command,
so to count all the times a line was added starting with “This” in a
period of time on all *md files I’ll do this:

find . -name *md | git log –since=”2012-10-11″ –until=”2012-10-12″
-p | grep -c –regexp=”+This”

Advertisements