mddanishyusuf / dailyhack

🐱‍💻 Tiny Tiny Hacks we use in our daily life.
https://dailyhack.now.sh/
149 stars 15 forks source link

Change the date of a git commit #39

Open HugoDF opened 5 years ago

HugoDF commented 5 years ago

Set the date of the last commit to the current date: GIT_COMMITTER_DATE="$(date)" git commit --amend --no-edit --date "$(date)"

Set the date of the last commit to an arbitrary date: GIT_COMMITTER_DATE="Mon 20 Aug 2018 20:19:19 BST" git commit --amend --no-edit --date "Mon 20 Aug 2018 20:19:19 BST"

Set the date of an arbitrary commit to an arbitrary or current date: Rebase to before said commit and stop for amendment + change the date as above. See Change the date of a git commit for full walkthrough of this case.