Toshusai blog

知識の保管庫

Gitでコミットの日時を変更する

1つ前のコミットのcomitter dateとauthor dateを現在の時刻に変更する

GIT_COMMITTER_DATE=\"$(date)\" git commit --amend --no-edit --date \"$(date)\"

特定のコミットを変更する

git rebase <commit-hash>^ -
  1. pickeに変更して保存
  2. amendで更新
git rebase --continue

rebaseを完了する

※当然ながらあとから変えない方が良い

参考

https://codewithhugo.com/change-the-date-of-a-git-commit/