How can one change the timestamp of an old commit in Git?

后端 未结 21 2414
慢半拍i
慢半拍i 2020-11-22 08:36

The answers to How to modify existing, unpushed commits? describe a way to amend previous commit messages that haven\'t yet been pushed upstream. The new messages inherit t

21条回答
  •  北恋
    北恋 (楼主)
    2020-11-22 08:48

    If commit not yet pushed then I can use something like that:

    git commit --amend --date=" Wed Mar 25 10:05:44 2020 +0300"
    

    after that git bash opens editor with the already applied date so you need just to save it by typing in the VI editor command mode ":wq" and you can push it

提交回复
热议问题