I’ve got this script
"$(date +%Y-%m-01) -$i months" +%Y-%m)-01"
that works great for getting the last 12 months from date, month by month. I want to have a static value for the time being used, so that instead of going back 12 months from the CURRENT TIME it is going back from a static time.
I’m using this with Github and I want to be consistent with the commits I sync to when I want to go back x months. How to specify time down to the second and use it with this script?
You could just use what
gitproves you:git log --since='X seconds ago', e.g. to list all commits in the last year (approximately 365*24*60*60=31536000 seconds)You can give an upper bound with
--until.If you want to list all commits one year before
SOME_DATEyou can usedate.