Allow to amend the commit date and author date of any commit
Is your feature request related to a problem? Please describe. I want to keep my history related to when I have done the work, but sometimes I need to commit a change after I have been working on it, so I need to amend the commit and/or author date of the commit.
Describe the solution you'd like A suggest a new option under the amend menu
Describe alternatives you've considered Making it manually, but the easy of use of lazygit will help.
I have a first version of a proposed implementation, but I think that it is better to create the PR after the feature has been evaluated.
https://github.com/japaz/lazygit/tree/amend-dates
I don't understand the need for this, especially not the need for setting the committer date. The committer date is very volatile and will be reset to the current date on any rebase, for example.
You're right about committer date volatility - I could focus on author date with an option to align committer date to match. The main use cases I see are: fixing incorrect system time/timezone issues, and providing easier access to Git's existing --date functionality for past commits without requiring complex interactive rebasing. Git already supports this natively, but lazygit could make the workflow more accessible.
I created a small custom command to do exactly this:
customCommands:
- key: "<c-a>"
context: "commits"
description: "Set commiter date to author date"
prompts:
- type: "confirm"
key: "Confirm"
title: "Set commiter date to author date"
body: "Are you sure you want to update the commiter date?"
command: "git rebase --autostash --keep-empty --no-autosquash --rebase-merges --committer-date-is-author-date {{.SelectedCommit.Hash}}^"
It would be cool if it was added to the "Amend commit attribute" menu.