kamranahmedse / git-standup

Recall what you did on the last working day. Psst! or be nosy and find what someone else in your team did ;-)
MIT License
7.63k stars 304 forks source link

Add SINCE_DATE environment variable to allow exact date ranges #91

Closed langford closed 6 years ago

langford commented 6 years ago

Currently, the "days ago" option does not act in a manner fit for the purpose of "standups" where some people work. The -d flag uses 24 hour periods, not calendar days. Standup meetings where some people work vary by time of day so that is insufficient for them: They need to report all activity since their last standup.

If you run the tool at 11 in the morning, -d 2 will miss commits you did at 7 am two days prior

Now you can exactly specify a start date through an environment variable. (You can already specify an exact end date via the "UNTIL_OPT" environment variable, so no changes were made there). For uniformity purposes, this PR adds this SINCE_DATE parameterization the same way GIT_DATE_FORMAT is specified.

Example usage of SINCE_DATE (complex, such as might be used in a script):

 # Requests all commits from 3 days prior starting at 4 in the morning in the eastern timezone of the US
 start=`date -v-3d -u +"%Y-%m-%dT04:00:00-04:00"`;
 SINCE_DATE=$start git-standup -s -m 8 -D format-local:"%a %I:%M %p"; 

Example usage (simple):

 # all work done this year (and maybe a late night commit or two on NYE)
 SINCE_DATE=2017-12-31  git-standup 
kamranahmedse commented 6 years ago

Thanks for the PR. Fixed in https://github.com/kamranahmedse/git-standup/pull/94

# Show all the commits after October 01, 2018
git standup -A "2018-10-01 00:00"
# Show all the commits till before October 01, 2018
git standup -B "2018-10-01 00:00"
# Show the commits between September 20 and September 30
git standup -A "2018-09-20 00:00:00" -B "2018-09-30 23:59"