git cake: when is my README's birthday?

πŸ“… December 28, 2020 β€’ πŸ•£ 1 min read β€’ 302 totalwords

git cake: when is my README's birthday?

Do you want to know when was a file/directory committed in your git repo? Well here is git log at your rescue!

git log --date=format:'%d %b %Y' --diff-filter=A --name-only --pretty='%n%C(yellow bold)πŸŽ‚οΈ %ad%Creset by (%C(blue bold)%h%Creset)'


Ok ok! Let me explain for you lazy asses

  • --date=format:'%d %b %Y'

    This is pretty much self explanatory, suit this to your own preferred date format. Other date formats

  • --diff-filter=A --name-only

    This lets you filter nodes that were Added(A). Other filters include: Copied(C), Deleted(D), Modified(M) or Renamed(R). Multiple filters can be used together e.g --diff-filter=AC.

    The --name-only shows only names of changed files. If you had like to print some status as well use --name-status

  • --pretty='%n%C(yellow bold)πŸŽ‚οΈ %ad%Creset by (%C(blue bold)%h%Creset)

    This is the beauty that is responsible for printing πŸŽ‚οΈ 18 Jun 2019 by (f72312c).

    Git provides us with various format specifiers these include.

    • %n : newline
    • %h : abbreviated commit hash (short version, use %H for complete hash)
    • %ad : author date that respects the previously specified –date= option

Read git pretty docs for info. on all 50+ options

Read more than 2000 lines worth of git log manual (git log --help) when you feel absolutely free :)

You should add this in your .gitconfig.

	email =
	name = Bhupesh-V
	template = /home/bhupesh/.gitmessage
	editor = nano
	helper = store
        cake = log --date=format:'%d %b %Y' --diff-filter=A --name-only --pretty='%n%C(yellow bold)πŸŽ‚οΈ %ad%Creset by (%C(blue bold)%h%Creset)'

Now send me some presents, will ya? Please?