git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* date change of commit?
@ 2009-10-25 11:35 Alex K
  2009-10-25 17:14 ` Matthieu Moy
  0 siblings, 1 reply; 7+ messages in thread
From: Alex K @ 2009-10-25 11:35 UTC (permalink / raw
  To: git

Hello,

Is it possible to change the date of a commit?

Thank you,

Alex

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

* Re: date change of commit?
  2009-10-25 11:35 date change of commit? Alex K
@ 2009-10-25 17:14 ` Matthieu Moy
  2009-10-27  9:41   ` Alex K
  0 siblings, 1 reply; 7+ messages in thread
From: Matthieu Moy @ 2009-10-25 17:14 UTC (permalink / raw
  To: Alex K; +Cc: git

Alex K <spaceoutlet@gmail.com> writes:

> Hello,
>
> Is it possible to change the date of a commit?

See git-filter-branch. This won't change the date of the existing
commit (which is impossible in Git), but will create another commit
where only the date has been changed.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

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

* Re: date change of commit?
  2009-10-25 17:14 ` Matthieu Moy
@ 2009-10-27  9:41   ` Alex K
  2009-10-27 12:21     ` Miklos Vajna
  0 siblings, 1 reply; 7+ messages in thread
From: Alex K @ 2009-10-27  9:41 UTC (permalink / raw
  To: Matthieu Moy; +Cc: git

Thank you. And how would you use git-filter-branch to create another
branch with a different time stamp? Is it possible to commit under a
different time stamp than the one provided by your default local time?

2009/10/25 Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>:
> Alex K <spaceoutlet@gmail.com> writes:
>
>> Hello,
>>
>> Is it possible to change the date of a commit?
>
> See git-filter-branch. This won't change the date of the existing
> commit (which is impossible in Git), but will create another commit
> where only the date has been changed.
>
> --
> Matthieu Moy
> http://www-verimag.imag.fr/~moy/
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* Re: date change of commit?
  2009-10-27  9:41   ` Alex K
@ 2009-10-27 12:21     ` Miklos Vajna
  2009-10-29 12:55       ` Alex K
  0 siblings, 1 reply; 7+ messages in thread
From: Miklos Vajna @ 2009-10-27 12:21 UTC (permalink / raw
  To: Alex K; +Cc: Matthieu Moy, git

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

On Tue, Oct 27, 2009 at 10:41:47AM +0100, Alex K <spaceoutlet@gmail.com> wrote:
> Thank you. And how would you use git-filter-branch to create another
> branch with a different time stamp? Is it possible to commit under a
> different time stamp than the one provided by your default local time?

You can set GIT_AUTHOR_DATE and GIT_COMMITTER_DATE. Both expect a format
like: "1112911993 -0700" (unix timestamp + timezone info).

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: date change of commit?
  2009-10-27 12:21     ` Miklos Vajna
@ 2009-10-29 12:55       ` Alex K
  2009-10-29 14:47         ` Rogan Dawes
  0 siblings, 1 reply; 7+ messages in thread
From: Alex K @ 2009-10-29 12:55 UTC (permalink / raw
  To: Miklos Vajna; +Cc: Matthieu Moy, git

And how do you actually set those variables? Sorry to ask such a
trivial question but it's been an hour that i'm going through the doc
for such a simple feature. I thought those were environment variables
... but they are not seen under git var -l. Thank you.

2009/10/27 Miklos Vajna <vmiklos@frugalware.org>:
> On Tue, Oct 27, 2009 at 10:41:47AM +0100, Alex K <spaceoutlet@gmail.com> wrote:
>> Thank you. And how would you use git-filter-branch to create another
>> branch with a different time stamp? Is it possible to commit under a
>> different time stamp than the one provided by your default local time?
>
> You can set GIT_AUTHOR_DATE and GIT_COMMITTER_DATE. Both expect a format
> like: "1112911993 -0700" (unix timestamp + timezone info).
>

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

* Re: date change of commit?
  2009-10-29 12:55       ` Alex K
@ 2009-10-29 14:47         ` Rogan Dawes
  2009-10-29 16:43           ` Thomas Rast
  0 siblings, 1 reply; 7+ messages in thread
From: Rogan Dawes @ 2009-10-29 14:47 UTC (permalink / raw
  To: Alex K; +Cc: Miklos Vajna, Matthieu Moy, git

Alex K wrote:
> And how do you actually set those variables? Sorry to ask such a
> trivial question but it's been an hour that i'm going through the doc
> for such a simple feature. I thought those were environment variables
> ... but they are not seen under git var -l. Thank you.
> 

As you suspected, they are environment variables.

i.e. :

$ GIT_AUTHOR_DATE="1112911993 -0700" git commit x

Hope that helps.

Rogan

> 2009/10/27 Miklos Vajna <vmiklos@frugalware.org>:
>> On Tue, Oct 27, 2009 at 10:41:47AM +0100, Alex K <spaceoutlet@gmail.com> wrote:
>>> Thank you. And how would you use git-filter-branch to create another
>>> branch with a different time stamp? Is it possible to commit under a
>>> different time stamp than the one provided by your default local time?
>> You can set GIT_AUTHOR_DATE and GIT_COMMITTER_DATE. Both expect a format
>> like: "1112911993 -0700" (unix timestamp + timezone info).
>>

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

* Re: date change of commit?
  2009-10-29 14:47         ` Rogan Dawes
@ 2009-10-29 16:43           ` Thomas Rast
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Rast @ 2009-10-29 16:43 UTC (permalink / raw
  To: Rogan Dawes; +Cc: Alex K, Miklos Vajna, Matthieu Moy, git

Rogan Dawes wrote:
> Alex K wrote:
> > And how do you actually set those variables? Sorry to ask such a
> > trivial question but it's been an hour that i'm going through the doc
> > for such a simple feature. I thought those were environment variables
> 
> As you suspected, they are environment variables.
> 
> i.e. :
> 
> $ GIT_AUTHOR_DATE="1112911993 -0700" git commit x

Since this was in the context of git-filter-branch, I should point out
that you'll have to use the variables with --env-filter and (like the
manpage says) make sure you export them.

So to change the date of a single commit with SHA1 <sha1>, you could
say

git filter-branch --env-filter '
  if [ $GIT_COMMIT = <sha1> ]; then
    export GIT_AUTHOR_DATE="1112911993 -0700"
    export GIT_COMMITTER_DATE="1112911993 -0700"
  fi
' <other_arguments>

Alex K wrote:
> for such a simple feature

I'm not sure if you're referring to setting the variables or actually
rewriting the commits here, but anyway:

The reason why the latter is so hard is that rewriting "old" history
is a _huge_ hassle for people who already have the previous version of
that history.

That being said, _why_?  The dates are never a guarantee that
something happened earlier or later precisely because they can easily
be modified at commit time.  So nobody should take them as more than a
hint, and there's little use in faking hints.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

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

end of thread, other threads:[~2009-10-29 16:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-25 11:35 date change of commit? Alex K
2009-10-25 17:14 ` Matthieu Moy
2009-10-27  9:41   ` Alex K
2009-10-27 12:21     ` Miklos Vajna
2009-10-29 12:55       ` Alex K
2009-10-29 14:47         ` Rogan Dawes
2009-10-29 16:43           ` Thomas Rast

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).