danglingfarpointer's memoization

仕事周りでの気付き、メモ、愚痴などを書いていきます。

gitコミットログのユーザーやタイムスタンプを修正

git commit --amend \
--date="Sat Jun 10 13:00:32 2014 +0900" \
--author="author <author@example.com>"

で、コミットしたユーザー(author)とその日時(author date)を修正できる。デフォルトのgit logで表示されるものが、これらである。

一方で、authorとauthor dateとは別に、committerとcommit dateがある。これらは、コミットをrebaseしたユーザーとその日時をトラックするために使われる。committerとcommit dateも修正するためには、以下のようにする:

GIT_COMMITTER_NAME="committer" \
GIT_COMMITTER_EMAIL="committer@example.com" \
GIT_COMMITTER_DATE="Sat Jun 10 13:05:32 2014 +0900" \
git commit --amend \
--date="Sat Jun 10 13:00:32 2014 +0900" \
--author="author <author@example.com>"

committerとcommit dateを確認するには、git logにオプションを与える:

git log --pretty=fuller