Git: show all commits on a given weekday

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

  • Non-recursive git log and diff
  • How to generate a sitemap from git log?
  • Can git log --decorate unambiguously tell me whether the HEAD is detached?
  • Make different `pretty` settings for git-log and git-show
  • Why isn't the pathspec magic :(exclude) excluding the specified files from git log's output?
  • How to `git log` a tree-ish from another branch?
  • How to get git-log to display commits using relative revision syntax of git-parse-rev
  • Why doesn't the Travis git ref match my pull request sometimes?
  • 4 Solutions collect form web for “Git: show all commits on a given weekday”

    Something like

    git log –pretty=’format:%h %cd’ |grep Sun

    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


    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.

    You can try to use:

    --since and --until

    key for git log command.

    jingx‘s answer is correct, upvoted!

    I just would like to mention that at some point I also wanted to retrieve the same kind of specificity, like any and all commits done:

    • on the -9 GMT hour
    • on the 33rd second
    • on Fri 13th
    • on 1337 files
    • with 777 impact (insertionsdeletions)

    …and found git log interface a bit lacking. But the data is there!

    I created therefore, which parses commits of any number of repositories into one conveniently sanitised JSON file. Enjoy!

    Git Baby is a git and github fan, let's start git clone.