Git: show all commits on a given weekday

git, git-log

Solution

Based on jingx's answer, the following will give you a log of all commits made on a Sunday.

git log --pretty='format:%h %cd' | grep 'Sun' |  awk '{print $1}' | while read rev; do
    git show $rev | head -6
done

Explanation

`git log --pretty='format:%h %cd'` gives a shortened log of all commits with their SHAs and commit dates. These dates contain day of the week as well.

`grep 'Sun'` filters out all lines of that log with 'Sun' on it, i.e., all commits made on Sundays.

`awk '{print $1}'` extracts the first word of each of these lines, i.e. the SHA values of each commit.

`while read rev` loops through each SHA value extracted from the previous `awk`. At each iteration, the SHA value will be stored in the `rev` variable.

`git show $rev` shows the log of the commit with the SHA `$rev`.

`head -6` extracts the first 6 lines of that log.

Problem

Can I see all of the commits which were made on a Sunday? Any and all Sundays, to be clear.

Original source