Skip to content
  • snails.dev

TIL: Commit with zero date to avoid creating a reflog entry

2023-03-07 1970-01-01

If you ever find yourself writing a tool around git, you might find this useful.

If you want to make a commit that doesn’t appear in the reflog, simply use zero Unix time for commit date, like this:

GIT_COMMITTER_DATE="@0 +0000" git commit

As far as I know this is not documented anywhere. I found out about this only by accident when I wanted to create commits with deterministic hashes.

Another way to make such a commit is to use the commit-tree plumbing command, which is just as magical I guess.

This blog is powered by sed. And snails 🐌

Gzipped with ❤️—how else—down to 2.0K