-2

I need to record roughly how long I worked on a project so I need to extract the dates from my commits co I can give a rough calculation. So fart I filter my commits with the

git log --author="^name^" -- path ^folder_that_work_upon^

But how I can make the git to deisplay the distinct dates from my git commit history? For example I need to do a list like:

Nov 29
Nov 15
Nov 22
Nov 17
...

So to know how may days I worked upon.

Dimitrios Desyllas
  • 9,082
  • 15
  • 74
  • 164
  • 1
    See also: https://stackoverflow.com/questions/7853332/how-to-change-git-log-date-formats, https://stackoverflow.com/questions/1441010/the-shortest-possible-output-from-git-log-containing-author-and-date – mkrieger1 Nov 19 '19 at 10:29

2 Answers2

2

You can change the output of git log to the desired format, and pipe the output into sort and uniq

git log --pretty=format:'%cd' --date=format:'%b %d' | sort | uniq

results in an output like

Nov 19
Nov 18
Nils Werner
  • 34,832
  • 7
  • 76
  • 98
-1

You shold add these params below

--pretty=format:'%cd' --date=format:'%b %d'

Other date format you can read How to change Git log date formats

caimaoy
  • 1,148
  • 1
  • 11
  • 25