Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
One of the greatest and worst things with git is that you can rewrite the history. Here’s a sneaky way of abusing that, I can’t think of a legitimate reason to do this.
As with anything, thanks StackOverflow for all the options I can pick from 👍.
GIT_COMMITTER_DATE="$(date)" git commit --amend --no-edit --date "$(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"
Rebase to before said commit and stop for amendment:
- git rebase <commit-hash>^ -i
- Replace pick with e (edit) on the line with that commit (the first one)
- quit the editor (ESC followed by :wq in VIM)
- Either:
- GIT_COMMITTER_DATE="$(date)" git commit --amend --no-edit --date "$(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"
See here for more information around rebasing and editing in git: Split an existing git commit.
Originally published at codewithhugo.com on August 29, 2018.
Change the date of a git commit was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.