git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Request to add option to interactive rebase to preserve latest commit date

From
JSJeff Schwartz <jefftschwartz@gmail.com>
Date
May 7, 2019, 10:52 UTC
Message-ID
<CAL3M-FamUTpygCWfi_EK7k59TsaG7zo5qu-zQTeBQ3WwY1g+hA@mail.gmail.com>
In-Reply-To
<alpine.DEB.2.20.1905070641380.1748@perkele.intern.softwolves.pp.se>

Yes, exactly. When squashing or fixup-ing commits via rebase I really want "git log" to show the date and time of the rebase operation and not the date and time of the commit I rebased onto, which could be months or even years in the past. I once worked on a project where part of the code-base hadn't been touched in over a year. After performing a number of WIPs on it over a 4 month period I cleaned up the final commit using interactive rebase, squashing all the WIPs into a single commit whose message reflected the actual scope of the changes that had been made. A naive project manager with limited understanding of Git other than how to use 'git log' to oversee what us developers have been up to time-wise was enraged that we had committed changes months back and appeared to have done nothing since then. I believe that by adding an option to 'rebase -i hash' that would apply the current date and time of the operation would be an awesome addition to Git and its user base.

*Jeff*
On Tue, May 7, 2019 at 1:45 AM Peter Krefting <peter@softwolves.pp.se> wrote:
Show 30 quoted lines
>
> Junio C Hamano:
>
> > as merely a different way to do the following:
> >
> >       $ git commit -m A
> >       $ edit
> >       $ edit further ;# working tree has an equivalent of C
> >       $ git commit --amend -a
>
> Indeed. My last command in the chain is usually
>
>    git commit --amend --date=now
>
> to set the commit date to now. In my use-case it is often a
> work-in-progress commit that I start out with, which I refine over a
> couple of hours/days/weeks to get working properly (depending on the
> complexity of the change), and when I am finally done, the proper
> dating of the change is "now", not "when I first started doing it".
>
> > I am still not convinced it is a good idea, but I can see how
> > another verb that behaves like existing "fixup" or "squash" but use
> > the authorship not from the updated but from the updating commit
> > might seem useful.
>
> I'd be happy with a parameter and/or configuration variable saying
> "amend and rebase uses last commit date".
>
> --
> \\// Peter - http://www.softwolves.pp.se/
Previous: Peter KreftingNext: Philip Oakley
Message 6 of 7 in “Request to add option to interactive rebase to preserve latest commit date”
  1. Jeff SchwartzApr 25, 2019
  2. Junio C HamanoApr 26, 2019
  3. Peter KreftingMay 1, 2019
  4. Junio C HamanoMay 7, 2019
  5. Peter KreftingMay 7, 2019
  6. Jeff SchwartzMay 7, 2019
  7. Philip OakleyMay 10, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.