Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

dirty git trick to establish history

I was working in a codebase that was previously not in Git, but I know the approximate age of the code, and the email address I had at the time. So I whipped an initial commit so I could then track my modern changes to this code.

GIT_AUTHOR_DATE="$( date -d "now - 355 days" )" \
    GIT_COMMITTER_DATE="$( date -d "now - 355 days" )" \
    GIT_AUTHOR_NAME="B. Stack" \
    GIT_COMMITTER_NAME="B. Stack" \
    GIT_AUTHOR_EMAIL="internaladdress@example.com" \
    GIT_COMMITTER_EMAIL="internaladdress@example.com" git commit -m 'initial commit'

Comments