git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* File version at a specific date?
@ 2006-07-31 17:56 Alexander ZVYAGIN
  2006-07-31 18:24 ` Jakub Narebski
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander ZVYAGIN @ 2006-07-31 17:56 UTC (permalink / raw)
  To: git

Hi,

I failed to find in the documentation how to look to a file content
at some moment in a past.

Something like this:
$ git checkout master~2 Makefile
when I specify not the revisions numbers ago the file was (~2),
but the time, for example "2005-12-12 00:00:00" or something like this.

Where should I look at?

Thanks in advance!
Alexander.

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

* Re: File version at a specific date?
  2006-07-31 17:56 File version at a specific date? Alexander ZVYAGIN
@ 2006-07-31 18:24 ` Jakub Narebski
  2006-07-31 22:20   ` Shawn Pearce
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Narebski @ 2006-07-31 18:24 UTC (permalink / raw)
  To: git

Alexander ZVYAGIN wrote:

> I failed to find in the documentation how to look to a file content
> at some moment in a past.
> 
> Something like this:
> $ git checkout master~2 Makefile
> when I specify not the revisions numbers ago the file was (~2),
> but the time, for example "2005-12-12 00:00:00" or something like this.
> 
> Where should I look at?

Either use git rev-list with --since=datestring, --after=datestring,
--until=datestring, --before=datestring to find a commit, or if you have
reflog enabled (you have .git/logs/refs/) you can use @{date} syntax,
see 'man git-rev-parse'

"A suffix @ followed by a date specification enclosed in a brace pair  (e.g.
 {yesterday},  {1  month  2 weeks 3 days 1 hour 1 second ago} or {1979-02-26
 18:30:00}) to specify the value of the ref at a prior point in  time.  This
 suffix  may  only be used immediately following a ref name and the ref must
 have an existing log ($GIT_DIR/logs/<ref>)."

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

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

* Re: File version at a specific date?
  2006-07-31 18:24 ` Jakub Narebski
@ 2006-07-31 22:20   ` Shawn Pearce
  0 siblings, 0 replies; 3+ messages in thread
From: Shawn Pearce @ 2006-07-31 22:20 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

Jakub Narebski <jnareb@gmail.com> wrote:
> Alexander ZVYAGIN wrote:
> 
> > I failed to find in the documentation how to look to a file content
> > at some moment in a past.
> > 
> > Something like this:
> > $ git checkout master~2 Makefile
> > when I specify not the revisions numbers ago the file was (~2),
> > but the time, for example "2005-12-12 00:00:00" or something like this.
> > 
> > Where should I look at?
> 
> Either use git rev-list with --since=datestring, --after=datestring,
> --until=datestring, --before=datestring to find a commit, or if you have
> reflog enabled (you have .git/logs/refs/) you can use @{date} syntax,
> see 'man git-rev-parse'
> 
> "A suffix @ followed by a date specification enclosed in a brace pair  (e.g.
>  {yesterday},  {1  month  2 weeks 3 days 1 hour 1 second ago} or {1979-02-26
>  18:30:00}) to specify the value of the ref at a prior point in  time.  This
>  suffix  may  only be used immediately following a ref name and the ref must
>  have an existing log ($GIT_DIR/logs/<ref>)."

I'd like to add something to the discussion, at least for the
benefit of the archives:

There's a semantic difference between the two date specification/query
styles suggested above:

	git rev-list with --since, --after, --until, --before will
	look at the date of the commit;

	@{date} after a ref name will look at the commit that was
	stored under that ref name at that point in time.

These are two entirely different timelines.  For example someone
could make a commit on Tuesday which you pull into your repository
on Thursday.  The commit will say (and thus git rev-list with
--since will say) that the file version existed on Tuesday, but the
reflog would say that the file version existed only as of Thursday,
as that was when it became available to your repository.

-- 
Shawn.

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

end of thread, other threads:[~2006-07-31 22:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-31 17:56 File version at a specific date? Alexander ZVYAGIN
2006-07-31 18:24 ` Jakub Narebski
2006-07-31 22:20   ` Shawn Pearce

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).