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

后端 未结 21 2613
慢半拍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:59

    I created this npm package to change date of old commits.

    https://github.com/bitriddler/git-change-date

    Sample Usage:

    npm install -g git-change-date
    cd [your-directory]
    git-change-date
    

    You will be prompted to choose the commit you want to modify then to enter the new date.

    If you want to change a commit by specific hash run this git-change-date --hash=[hash]

提交回复
热议问题