threads / discuss / 7998

How to set git commit timestamp

Subject: How to set git commit timestamp

## tl;dr

9 messages between May 6, 2007 and May 11, 2007.

replies: 8people: 7as markdown or json

Guido Ostkamp· May 6, 2007, 16:03 UTC · lore
Hello,
does somebody know a method to specify a timestamp for a 'git commit'?

I am writing a tool to convert from another SCM to git and need to replay all checkins. I know how to set the log message and the author, but there appears to be no command option for the timestamp (Mercurial for example, has a 'hg commit -d date <file>' syntax for this).

Any help is appreciated.
Regards
Guido
Alex Riesen· May 6, 2007, 16:41 UTC · re: Guido Ostkamp · lore

Re: How to set git commit timestamp

Guido Ostkamp, Sun, May 06, 2007 18:03:14 +0200:
> 
> does somebody know a method to specify a timestamp for a 'git commit'?
> 
Set GIT_AUTHOR_DATE (and maybe GIT_COMMITTER_DATE) in the environment.
René Scharfe· May 6, 2007, 17:26 UTC · re: Guido Ostkamp · lore

Re: How to set git commit timestamp

Guido Ostkamp schrieb:
Show 8 quoted lines
> Hello,
> 
> does somebody know a method to specify a timestamp for a 'git commit'?
> 
> I am writing a tool to convert from another SCM to git and need to
> replay all checkins. I know how to set the log message and the author,
> but there appears to be no command option for the timestamp (Mercurial
> for example, has a 'hg commit -d date <file>' syntax for this).

You can use the environment variable GIT_COMMITTER_DATE to force a specific commit date. Please see the man page of git-commit-tree for (some) more info.

René
Robin Rosenberg· May 6, 2007, 19:51 UTC · re: Guido Ostkamp · lore

Re: How to set git commit timestamp

söndag 06 maj 2007 skrev Guido Ostkamp:
Show 8 quoted lines
> Hello,
> 
> does somebody know a method to specify a timestamp for a 'git commit'?
> 
> I am writing a tool to convert from another SCM to git and need to replay 
> all checkins. I know how to set the log message and the author, but there 
> appears to be no command option for the timestamp (Mercurial for example, 
> has a 'hg commit -d date <file>' syntax for this).

If you are writing a converter then you should really use the plumbing commands rather than porcelains like git-commit and in particular you should look at git-fast-import for a really fast methord of importing (and packing) objects.

-- robin
Shawn O. Pearce· May 8, 2007, 01:38 UTC · re: Robin Rosenberg · lore

Re: How to set git commit timestamp

Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
Show 10 quoted lines
> söndag 06 maj 2007 skrev Guido Ostkamp:
> > I am writing a tool to convert from another SCM to git and need to replay 
> > all checkins. I know how to set the log message and the author, but there 
> > appears to be no command option for the timestamp (Mercurial for example, 
> > has a 'hg commit -d date <file>' syntax for this).
> 
> If you are writing a converter then you should really use the plumbing 
> commands rather than porcelains like git-commit and in particular you should 
> look at git-fast-import for a  really fast methord of importing (and packing) 
> objects.

As the author of a few convert-to-git things, fast-import really is the easiest way to import stuff into git, even if it doesn't need to be "fast". The input format is quite simple to create, and is documented pretty heavily in the git-fast-import manual page.

There's also contrib/fast-import/import-tars.pl which handles decompressing and importing one or more tar files into a Git repository. Works pretty well...

So I agree with Robin, give fast-import a try.
-- 
Shawn.
Jakub Narebski· May 8, 2007, 01:54 UTC · re: Shawn O. Pearce · lore

Re: How to set git commit timestamp

Shawn O. Pearce wrote:
> Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
>> söndag 06 maj 2007 skrev Guido Ostkamp:
Show 18 quoted lines
>>> I am writing a tool to convert from another SCM to git and need to replay 
>>> all checkins. I know how to set the log message and the author, but there 
>>> appears to be no command option for the timestamp (Mercurial for example, 
>>> has a 'hg commit -d date <file>' syntax for this).
>> 
>> If you are writing a converter then you should really use the plumbing 
>> commands rather than porcelains like git-commit and in particular you should 
>> look at git-fast-import for a  really fast methord of importing (and packing) 
>> objects.
> 
> As the author of a few convert-to-git things, fast-import really
> is the easiest way to import stuff into git, even if it doesn't
> need to be "fast".  The input format is quite simple to create,
> and is documented pretty heavily in the git-fast-import manual page.
> 
> There's also contrib/fast-import/import-tars.pl which handles
> decompressing and importing one or more tar files into a Git
> repository.  Works pretty well...
By the way, is there fast-import version of git-quiltimport?
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Shawn O. Pearce· May 8, 2007, 01:57 UTC · re: Jakub Narebski · lore

Re: How to set git commit timestamp

Jakub Narebski <jnareb@gmail.com> wrote:
> By the way, is there fast-import version of git-quiltimport?

No, and I don't think its easy. Isn't a quilt patchstack stored as a series of patch files? So "importing" it into Git requires applying the patch to the base tree, then writing that base tree to the ODB. fast-import doesn't know how to run git-apply, though Junio and I did kick it around (generally) a few months ago on #git.

-- 
Shawn.
Johannes Schindelin· May 8, 2007, 11:29 UTC · re: Shawn O. Pearce · lore

Re: How to set git commit timestamp

Hi,
On Mon, 7 May 2007, Shawn O. Pearce wrote:
Show 8 quoted lines
> Jakub Narebski <jnareb@gmail.com> wrote:
> > By the way, is there fast-import version of git-quiltimport?
> 
> No, and I don't think its easy.  Isn't a quilt patchstack stored as a 
> series of patch files?  So "importing" it into Git requires applying the 
> patch to the base tree, then writing that base tree to the ODB.  
> fast-import doesn't know how to run git-apply, though Junio and I did 
> kick it around (generally) a few months ago on #git.

You'd have to pretend that all of these patches are branches. Well, in the end they are...

Ciao, Dscho

Jakub Narebski· May 11, 2007, 10:58 UTC · re: Johannes Schindelin · lore

Re: How to set git commit timestamp

On Tue, 8 May 2007, Johannes Schindelin wrote: 
> On Mon, 7 May 2007, Shawn O. Pearce wrote:
>> Jakub Narebski <jnareb@gmail.com> wrote:
Show 10 quoted lines
>>> By the way, is there fast-import version of git-quiltimport?
>> 
>> No, and I don't think its easy.  Isn't a quilt patchstack stored as a 
>> series of patch files?  So "importing" it into Git requires applying the 
>> patch to the base tree, then writing that base tree to the ODB.  
>> fast-import doesn't know how to run git-apply, though Junio and I did 
>> kick it around (generally) a few months ago on #git.
> 
> You'd have to pretend that all of these patches are branches. Well, in the 
> end they are...
Or rather that patch _series_ are branches. 

It would be also nice to have one of the patch management UI on top of git like StGIT or Guilt (IIRC pg is no longer maintained) to import series of patches as unapplied from Quilt (or from mbox/file).

-- 
Jakub Narebski
Poland

← back to recent threads