Question

I want to create really simple statistics from my code. I use git rev-list to obtain list of all commits back to history. But for my purposes only the last commit of the day is interesting. I want to omit all commits that precedes that commit during any particular day. Given the history:

c1375e3 Nov 13 07:55:31
110d2ec Nov 13 07:41:47
30331dd Nov 12 21:23:47
431addf Nov 12 18:50:52
8a32d78 Nov 12 18:27:24
ace5a88 Nov 12 18:24:55

I'm interested only in commits 30331dd and c1375e3. How I can get list like that?

Was it helpful?

Solution

You could pipe the output of the git rev-list command you use into awk:

git rev-list your_command | awk '{if(m!=$2 || d!=$3){m=$2;d=$3; print $1}}'

Of course, it will work only if the list of commits is ordered by date and time, as shown in your example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top