git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git rebase -i without altering the committer date
@ 2016-04-20 20:24 Shaun Jackman
  2016-04-20 20:36 ` Junio C Hamano
  2016-04-20 21:47 ` Andreas Schwab
  0 siblings, 2 replies; 6+ messages in thread
From: Shaun Jackman @ 2016-04-20 20:24 UTC (permalink / raw)
  To: git

I'd like to insert a commit between two commits without changing the committer date or author date of that commit or the subsequent commits. I'd planned on using `git rebase -i` to insert the commit. I believe it retains the author date, but changes the committer date to the current time. I've seen the options `--committer-date-is-author-date` and `--ignore-date`, but I don't believe either of those options does what I want. If no such option currently exists to leave the committer and author date unchanged, is there any chance that this functionality could please be implemented?

For a relevant SO question, see 
How to make a git rebase and keep the commit timestamp?
http://stackoverflow.com/questions/30790645/how-to-make-a-git-rebase-and-keep-the-commit-timestamp

Thanks, 
Shaun

-- 
http://sjackman.ca

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git rebase -i without altering the committer date
  2016-04-20 20:24 git rebase -i without altering the committer date Shaun Jackman
@ 2016-04-20 20:36 ` Junio C Hamano
  2016-04-20 21:15   ` Shaun Jackman
  2016-04-20 21:47 ` Andreas Schwab
  1 sibling, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2016-04-20 20:36 UTC (permalink / raw)
  To: Shaun Jackman; +Cc: git

Shaun Jackman <sjackman@gmail.com> writes:

> I'd like to insert a commit between two commits without changing
> the committer date or author date of that commit or the subsequent
> commits. I'd planned on using `git rebase -i` to insert the
> commit. I believe it retains the author date, but changes the
> committer date to the current time. I've seen the options
> `--committer-date-is-author-date` and `--ignore-date`, but I don't
> believe either of those options does what I want. If no such
> option currently exists to leave the committer and author date
> unchanged, is there any chance that this functionality could
> please be implemented?

You can mark the commit as "edit", use "git commit --amend" when
"rebase -i" stops and gives control back to you, and say "rebase
--continue".  That way, you can use your favourite trick to lie
about committer date (or identity or other aspects) when running
"git commit --amend" and its effect will be left in the resulting
history, I would think.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git rebase -i without altering the committer date
  2016-04-20 20:36 ` Junio C Hamano
@ 2016-04-20 21:15   ` Shaun Jackman
  0 siblings, 0 replies; 6+ messages in thread
From: Shaun Jackman @ 2016-04-20 21:15 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On April 20, 2016 at 13:37:01, Junio C Hamano (gitster@pobox.com(mailto:gitster@pobox.com)) wrote:
> Shaun Jackman writes: 
> 
> > I'd like to insert a commit between two commits without changing 
> > the committer date or author date of that commit or the subsequent 
> > commits. I'd planned on using `git rebase -i` to insert the 
> > commit. I believe it retains the author date, but changes the 
> > committer date to the current time. I've seen the options 
> > `--committer-date-is-author-date` and `--ignore-date`, but I don't 
> > believe either of those options does what I want. If no such 
> > option currently exists to leave the committer and author date 
> > unchanged, is there any chance that this functionality could 
> > please be implemented? 
> 
> You can mark the commit as "edit", use "git commit --amend" when 
> "rebase -i" stops and gives control back to you, and say "rebase 
> --continue". That way, you can use your favourite trick to lie 
> about committer date (or identity or other aspects) when running 
> "git commit --amend" and its effect will be left in the resulting 
> history, I would think. 

Thanks for the suggestion, Junio. That would retain the committer date for the commit being inserted. I believe that the subsequent commits would have their committer date modified to the current time by the `git rebase --continue`.

Cheers,
Shaun

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git rebase -i without altering the committer date
  2016-04-20 20:24 git rebase -i without altering the committer date Shaun Jackman
  2016-04-20 20:36 ` Junio C Hamano
@ 2016-04-20 21:47 ` Andreas Schwab
  2016-04-21  5:23   ` Johannes Sixt
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2016-04-20 21:47 UTC (permalink / raw)
  To: Shaun Jackman; +Cc: git

Shaun Jackman <sjackman@gmail.com> writes:

> I'd like to insert a commit between two commits without changing the committer date or author date of that commit or the subsequent commits. I'd planned on using `git rebase -i` to insert the commit. I believe it retains the author date, but changes the committer date to the current time. I've seen the options `--committer-date-is-author-date` and `--ignore-date`, but I don't believe either of those options does what I want. If no such option currently exists to leave the committer and author date unchanged, is there any chance that this functionality could please be implemented?

The easiest way to implement that is to add a graft to redirect the
parent of the second commit to the inserted commit, then use git
filter-branch to make the graft permanent.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git rebase -i without altering the committer date
  2016-04-20 21:47 ` Andreas Schwab
@ 2016-04-21  5:23   ` Johannes Sixt
  2016-04-21  7:17     ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Sixt @ 2016-04-21  5:23 UTC (permalink / raw)
  To: Andreas Schwab, Shaun Jackman; +Cc: git

Am 20.04.2016 um 23:47 schrieb Andreas Schwab:
> Shaun Jackman <sjackman@gmail.com> writes:
>
>> I'd like to insert a commit between two commits without changing
>> the committer date or author date of that commit or the subsequent
>> commits.
>
> The easiest way to implement that is to add a graft to redirect the
> parent of the second commit to the inserted commit, then use git
> filter-branch to make the graft permanent.

This only inserts a new project state, but does not propagate the 
changes brought in by the new commit to the subsequent commits. This 
propagation of changes could also be done with filter-branch, but it may 
be difficult depending on circumstances.

-- Hannes

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git rebase -i without altering the committer date
  2016-04-21  5:23   ` Johannes Sixt
@ 2016-04-21  7:17     ` Johannes Schindelin
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Schindelin @ 2016-04-21  7:17 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Andreas Schwab, Shaun Jackman, git

Hi,

On Thu, 21 Apr 2016, Johannes Sixt wrote:

> Am 20.04.2016 um 23:47 schrieb Andreas Schwab:
> > Shaun Jackman <sjackman@gmail.com> writes:
> >
> > > I'd like to insert a commit between two commits without changing
> > > the committer date or author date of that commit or the subsequent
> > > commits.
> >
> > The easiest way to implement that is to add a graft to redirect the
> > parent of the second commit to the inserted commit, then use git
> > filter-branch to make the graft permanent.
> 
> This only inserts a new project state, but does not propagate the changes
> brought in by the new commit to the subsequent commits. This propagation of
> changes could also be done with filter-branch, but it may be difficult
> depending on circumstances.

I agree that rebase -i is the wrong wrench for this job. Either use
filter-branch or fast-export/edit/fast-import.

Or take a step back and ask yourself why you need to fool anybody about
the commit date... ;-D

Ciao,
Johannes

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-04-21  7:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-20 20:24 git rebase -i without altering the committer date Shaun Jackman
2016-04-20 20:36 ` Junio C Hamano
2016-04-20 21:15   ` Shaun Jackman
2016-04-20 21:47 ` Andreas Schwab
2016-04-21  5:23   ` Johannes Sixt
2016-04-21  7:17     ` Johannes Schindelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).