# How to set git commit timestamp

9 messages from 2007-05-06 to 2007-05-11. Participants: Guido Ostkamp, Alex Riesen, René Scharfe, Robin Rosenberg, Shawn O. Pearce, Jakub Narebski, Johannes Schindelin.
Thread: https://gitlist.dev/t/7998

## Guido Ostkamp, 2007-05-06 16:03

Subject: How to set git commit timestamp
Message-ID: <Pine.LNX.4.64.0705061759210.8165@bianca.dialin.t-online.de>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0705061759210.8165%40bianca.dialin.t-online.de

```
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, 2007-05-06 16:41

Subject: Re: How to set git commit timestamp
Message-ID: <20070506164136.GB2434@steel.home>
URL: https://gitlist.dev/e/20070506164136.GB2434%40steel.home
In-Reply-To: <Pine.LNX.4.64.0705061759210.8165@bianca.dialin.t-online.de>

```
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, 2007-05-06 17:26

Subject: Re: How to set git commit timestamp
Message-ID: <463E0FDE.3000504@lsrfire.ath.cx>
URL: https://gitlist.dev/e/463E0FDE.3000504%40lsrfire.ath.cx
In-Reply-To: <Pine.LNX.4.64.0705061759210.8165@bianca.dialin.t-online.de>

```
Guido Ostkamp schrieb:
> 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, 2007-05-06 19:51

Subject: Re: How to set git commit timestamp
Message-ID: <200705062151.40261.robin.rosenberg.lists@dewire.com>
URL: https://gitlist.dev/e/200705062151.40261.robin.rosenberg.lists%40dewire.com
In-Reply-To: <Pine.LNX.4.64.0705061759210.8165@bianca.dialin.t-online.de>

```
söndag 06 maj 2007 skrev Guido Ostkamp:
> 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, 2007-05-08 01:38

Subject: Re: How to set git commit timestamp
Message-ID: <20070508013833.GB11311@spearce.org>
URL: https://gitlist.dev/e/20070508013833.GB11311%40spearce.org
In-Reply-To: <200705062151.40261.robin.rosenberg.lists@dewire.com>

```
Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
> 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, 2007-05-08 01:54

Subject: Re: How to set git commit timestamp
Message-ID: <f1ol0d$tcd$1@sea.gmane.org>
URL: https://gitlist.dev/e/f1ol0d%24tcd%241%40sea.gmane.org
In-Reply-To: <20070508013833.GB11311@spearce.org>

```
Shawn O. Pearce wrote:
> Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
>> 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...

By the way, is there fast-import version of git-quiltimport?

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

```

## Shawn O. Pearce, 2007-05-08 01:57

Subject: Re: How to set git commit timestamp
Message-ID: <20070508015702.GE11311@spearce.org>
URL: https://gitlist.dev/e/20070508015702.GE11311%40spearce.org
In-Reply-To: <f1ol0d$tcd$1@sea.gmane.org>

```
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, 2007-05-08 11:29

Subject: Re: How to set git commit timestamp
Message-ID: <Pine.LNX.4.64.0705081328420.4167@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0705081328420.4167%40racer.site
In-Reply-To: <20070508015702.GE11311@spearce.org>

```
Hi,

On Mon, 7 May 2007, Shawn O. Pearce wrote:

> 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, 2007-05-11 10:58

Subject: Re: How to set git commit timestamp
Message-ID: <200705111258.35050.jnareb@gmail.com>
URL: https://gitlist.dev/e/200705111258.35050.jnareb%40gmail.com
In-Reply-To: <Pine.LNX.4.64.0705081328420.4167@racer.site>

```
On Tue, 8 May 2007, Johannes Schindelin wrote: 
> On Mon, 7 May 2007, Shawn O. Pearce wrote:
>> 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...

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

```
