From: Phillip Wood Date: Tue, 24 Oct 2023 09:26:29 GMT Subject: Re: using oldest date when squashing commits Message-ID: In-Reply-To: <9fae5292-d58f-95da-245b-6e205383cb50@kdbg.org> On 20/03/2022 08:05, Johannes Sixt wrote: > Am 19.03.22 um 13:48 schrieb Oswald Buddenhagen: >> during interactive rebasing, i sometimes find it necessary to move a >> hunk from one commit to a later one in the branch. now, if that hunk >> cannot be re-ordered with the later commit due to conflicting with it, >> it becomes necessary to squash the later commit onto a temporary commit >> created from the extracted hunk, not the other way around (or using a >> stash). unfortunately, this causes the author date of the later commit >> to be reset, which can rather seriously falsify the date if the branch >> is long-lived. > > You want `fixup -C` in the todo-list. See the hints near the end of the > todo-list. Unfortunately "fixup -C" only copies the commit message not the authorship (that's usually a good thing but not it means it wont work for what Oswald wants to do). Maybe we should add another flag for fixup/squash commands to take the authorship from that commit. In the meantime creating the temporary commit with "git commit -C" is probably the easiest way to keep the original authorship. Best Wishes Phillip