Home > Software design >  Date format for committerdate on git for-each-ref
Date format for committerdate on git for-each-ref

Time:01-10

I'm using this to get a list of stale branches in our repo:

git for-each-ref --sort='-committerdate' refs/remotes --format='"%(refname)",%(committerdate),"%(authorname)"' > branches.csv

But the committerdate comes out like this: Thu Jan 7 15:45:35 2021 -0700

Can I make it come out like this instead? Jan 7 2021 15:45:35 -0700

CodePudding user response:

git for-each-ref --sort='-committerdate' refs/remotes --format='"%(refname)",%(committerdate:iso),"%(authorname)"' > branches.csv

Shows like this (easier sorted datetime) 2021-01-07 15:45:35 -0700

Works perfectly but I do not like the TZ being displayed, have to take that out with a text editor before opening in Excel. ;-)

  •  Tags:  
  • git
  • Related