0

If squashing multiple branches how can I get the message date to get updated?

e.g. I just spent the last hour trying to find a copy of the code in order to verify what I have is up to date because the date on the last message is from 2 weeks ago when I know yesterday I had squashed a small fix into the branch.

Is it possible to get the date updated when squashing?

Based on an old post from 2012 it looks like this is a close solution:

git commit --amend --reset-author

but I don't want to have to be prompted and I don't want to have to specify manually the date.

git commit --amend --date="Wed Apr 15 13:00 2037 -0700"

How can I make it automatically set the date to now as I don't want to have to enter the date manually?

edjm
  • 4,830
  • 7
  • 36
  • 65
  • 1
    Does this answer your question? [How do I squash commits in git with a commit date that is not in the past?](https://stackoverflow.com/questions/13262465/how-do-i-squash-commits-in-git-with-a-commit-date-that-is-not-in-the-past) – lucidbrot Aug 04 '20 at 17:40
  • 1
    @lucidbrot Thank you very much for the link. I think that is what I'll be needing to do for now on. – edjm Aug 04 '20 at 17:42
  • Nice! Happy to help ^.^ I also learnt something new today – lucidbrot Aug 04 '20 at 17:43
  • @lucidbrot the linked solution does work but I still have to do a couple additional steps. Might you know how I can automatically get the date updated without having to go into the prompting, or manually setting a date? – edjm Aug 04 '20 at 17:54
  • You can use the [no-edit flag](https://stackoverflow.com/a/10365442/2550406) as in `git commit --amend --no-edit --reset-author`. But after reading [this answer](https://stackoverflow.com/a/61237201/2550406) it sounds like that can lead to confusions and it's better to use `git commit --amend --date="now" --no-edit` – lucidbrot Aug 04 '20 at 18:16

0 Answers0