+++ date = "2024-04-02T01:01:28+00:00" lastmod = "2024-04-02T01:01:28+00:00" tags = [ "gists", "programs" ] +++ A quick wrapper script for normalized [git](https://git-scm.com/) commit dates. Commit dates and timezones are normalized or truncated to the day. This is useful for avoiding [rebasing](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) and/or not having to think about system or git date/time settings when on another device or in another timezone. If precise timestamps matter, then it is easily disabled. ```shell { caption="Inspired by [git privacy](https://git.nicholasjohnson.ch/git-privacy/about/) in [Git Rev News 102](https://git.github.io/rev_news/2023/08/31/edition-102/#support)" } #!/bin/sh -eu GIT=$(which git --all | grep --invert-match "local/bin" | head --lines 1) GIT_COMMITTER_DATE="$(date --utc --date '0' '+%a %b %d %H:%M:%S %Y %z')" export GIT_COMMITTER_DATE [ "${1:-}" = "commit" ] && export DATE=1 && $GIT "$@" --date="$GIT_COMMITTER_DATE" [ "${DATE:-}" = 1 ] && exit $GIT "$@" ```