git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Getting a file revision
@ 2007-08-19  0:42 Bahadir Balban
  2007-08-19  0:52 ` Junio C Hamano
  2007-08-19  0:52 ` Getting a file revision J. Bruce Fields
  0 siblings, 2 replies; 11+ messages in thread
From: Bahadir Balban @ 2007-08-19  0:42 UTC (permalink / raw)
  To: git

Hi,

This might sound like a novice question but anyway: I sometimes have a
need to quickly recover an old revision of a file just to check
something or copy some code from it. I would imagine having a command
like:

git-getrev <filename> <commit> or something, and the file would appear
in its path, or the git root directory as <filename>.<commit>

Is there an existing way to achieve a similar result? I can certainly
checkout a branch, revert to that commit I want, copy the file, and
come back to HEAD, but its not as quick.

Thanks,
Bahadir

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

* Re: Getting a file revision
  2007-08-19  0:42 Getting a file revision Bahadir Balban
@ 2007-08-19  0:52 ` Junio C Hamano
  2007-08-20 11:38   ` Jerome Lovy
  2007-08-19  0:52 ` Getting a file revision J. Bruce Fields
  1 sibling, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2007-08-19  0:52 UTC (permalink / raw)
  To: Bahadir Balban; +Cc: git

"Bahadir Balban" <bahadir.balban@gmail.com> writes:

> This might sound like a novice question but anyway: I sometimes have a
> need to quickly recover an old revision of a file just to check
> something or copy some code from it.

$ git show -p $commit:$path >$path.old-version

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

* Re: Getting a file revision
  2007-08-19  0:42 Getting a file revision Bahadir Balban
  2007-08-19  0:52 ` Junio C Hamano
@ 2007-08-19  0:52 ` J. Bruce Fields
  1 sibling, 0 replies; 11+ messages in thread
From: J. Bruce Fields @ 2007-08-19  0:52 UTC (permalink / raw)
  To: Bahadir Balban; +Cc: git

On Sun, Aug 19, 2007 at 01:42:30AM +0100, Bahadir Balban wrote:
> This might sound like a novice question but anyway: I sometimes have a
> need to quickly recover an old revision of a file just to check
> something or copy some code from it. I would imagine having a command
> like:
> 
> git-getrev <filename> <commit> or something, and the file would appear
> in its path, or the git root directory as <filename>.<commit>
> 
> Is there an existing way to achieve a similar result? I can certainly
> checkout a branch, revert to that commit I want, copy the file, and
> come back to HEAD, but its not as quick.

Easiest is probably to use git-show together with the
<commit>:<filename> syntax, so e.g.:

	git show v1.4:src/main.c
	git show 74ace5df:Makefile >Makefile.tmp

--b.

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

* Re: Getting a file revision
  2007-08-19  0:52 ` Junio C Hamano
@ 2007-08-20 11:38   ` Jerome Lovy
  2007-08-21 12:49     ` [PATCH] Document the -p option for git-show Miklos Vajna
  0 siblings, 1 reply; 11+ messages in thread
From: Jerome Lovy @ 2007-08-20 11:38 UTC (permalink / raw)
  To: git

Hi,

Junio C Hamano wrote:
> "Bahadir Balban" <bahadir.balban@gmail.com> writes:
> 
>> This might sound like a novice question but anyway: I sometimes have a
>> need to quickly recover an old revision of a file just to check
>> something or copy some code from it.
> 
> $ git show -p $commit:$path >$path.old-version
Is "-p" a short version of "--pretty" ?

(I do not see it documented in the man-page and assume it is not the 
"-p" applicable to git-diff-tree, is it ?)

Thanks,
Jérôme

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

* [PATCH] Document the -p option for git-show.
  2007-08-20 11:38   ` Jerome Lovy
@ 2007-08-21 12:49     ` Miklos Vajna
  2007-08-21 13:09       ` Johannes Sixt
  2007-08-21 17:01       ` Robin Rosenberg
  0 siblings, 2 replies; 11+ messages in thread
From: Miklos Vajna @ 2007-08-21 12:49 UTC (permalink / raw)
  To: git, Junio C Hamano

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 Documentation/git-show.txt |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-show.txt b/Documentation/git-show.txt
index a42e121..2409389 100644
--- a/Documentation/git-show.txt
+++ b/Documentation/git-show.txt
@@ -33,6 +33,10 @@ This manual page describes only the most frequently used options.
 
 OPTIONS
 -------
+
+-p::
+	For commits, show the change the commit introduces in a patch form.
+
 <object>::
 	The name of the object to show.
 	For a more complete list of ways to spell object names, see
-- 
1.5.2.2

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

* Re: [PATCH] Document the -p option for git-show.
  2007-08-21 12:49     ` [PATCH] Document the -p option for git-show Miklos Vajna
@ 2007-08-21 13:09       ` Johannes Sixt
  2007-08-21 14:29         ` VMiklos
  2007-08-21 15:02         ` David Kastrup
  2007-08-21 17:01       ` Robin Rosenberg
  1 sibling, 2 replies; 11+ messages in thread
From: Johannes Sixt @ 2007-08-21 13:09 UTC (permalink / raw)
  To: git

Miklos Vajna wrote:
> +-p::
> +       For commits, show the change the commit introduces in a patch form.

This is already documented by referencing git-diff-tree a few lines
above:

	The command takes options applicable to the git-diff-tree[1]
	command to control how the changes the commit introduces are
	shown.

The man page of git-diff-tree talks about -p, and a lot more options.

Side note: -p is the default for git-show (of commits). Nevertheless, it
makes sense to specify it in combination with other options:

	git show -p --stat

will show both the patch and the statistics.

-- Hannes

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

* Re: [PATCH] Document the -p option for git-show.
  2007-08-21 13:09       ` Johannes Sixt
@ 2007-08-21 14:29         ` VMiklos
  2007-08-21 15:02         ` David Kastrup
  1 sibling, 0 replies; 11+ messages in thread
From: VMiklos @ 2007-08-21 14:29 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

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

Hello,

Na Tue, Aug 21, 2007 at 03:09:48PM +0200, Johannes Sixt <J.Sixt@eudaptics.com> pisal(a):
> This is already documented by referencing git-diff-tree a few lines
> above:
> 
> 	The command takes options applicable to the git-diff-tree[1]
> 	command to control how the changes the commit introduces are
> 	shown.
> (..)
> Side note: -p is the default for git-show (of commits). Nevertheless, it
> makes sense to specify it in combination with other options:
> 
> 	git show -p --stat
> 
> will show both the patch and the statistics.

Hm, but -p is used by default for git show, right? And this is not
documented anywhere IMHO. (Maybe other options are used by default,
too?)

- VMiklos

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

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

* Re: [PATCH] Document the -p option for git-show.
  2007-08-21 13:09       ` Johannes Sixt
  2007-08-21 14:29         ` VMiklos
@ 2007-08-21 15:02         ` David Kastrup
  1 sibling, 0 replies; 11+ messages in thread
From: David Kastrup @ 2007-08-21 15:02 UTC (permalink / raw)
  To: git

Johannes Sixt <J.Sixt@eudaptics.com> writes:

> Miklos Vajna wrote:
>> +-p::
>> +       For commits, show the change the commit introduces in a patch form.
>
> This is already documented by referencing git-diff-tree a few lines
> above:
>
> 	The command takes options applicable to the git-diff-tree[1]
> 	command to control how the changes the commit introduces are
> 	shown.
>
> The man page of git-diff-tree talks about -p, and a lot more
> options.

I am not really convinced this is a good idea: at the current point of
time, man-pages are not pulled into they user manual or any other
complete reference tome.  So they are basically standalone.  Even if
they weren't, I think it does not make all too much sense for a
porcelain command to point to the documentation of a plumbing command
for much of its functionality.

-- 
David Kastrup

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

* Re: [PATCH] Document the -p option for git-show.
  2007-08-21 12:49     ` [PATCH] Document the -p option for git-show Miklos Vajna
  2007-08-21 13:09       ` Johannes Sixt
@ 2007-08-21 17:01       ` Robin Rosenberg
  2007-08-21 17:33         ` Junio C Hamano
  1 sibling, 1 reply; 11+ messages in thread
From: Robin Rosenberg @ 2007-08-21 17:01 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: git, Junio C Hamano

tisdag 21 augusti 2007 skrev Miklos Vajna:
> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
> ---
>  Documentation/git-show.txt |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/Documentation/git-show.txt b/Documentation/git-show.txt
> index a42e121..2409389 100644
> --- a/Documentation/git-show.txt
> +++ b/Documentation/git-show.txt
> @@ -33,6 +33,10 @@ This manual page describes only the most frequently used options.
>  
>  OPTIONS
>  -------
> +
> +-p::
> +	For commits, show the change the commit introduces in a patch form.
> +
>  <object>::
>  	The name of the object to show.
>  	For a more complete list of ways to spell object names, see
How about this instead:

-- robin

Include diff options into git-show command manual

--
 Documentation/git-show.txt |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-show.txt b/Documentation/git-show.txt
index a42e121..d4708e0 100644
--- a/Documentation/git-show.txt
+++ b/Documentation/git-show.txt
@@ -41,6 +41,9 @@ OPTIONS
 include::pretty-options.txt[]
 
 
+include::diff-options.txt[]
+
+
 include::pretty-formats.txt[]
 
 

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

* Re: [PATCH] Document the -p option for git-show.
  2007-08-21 17:01       ` Robin Rosenberg
@ 2007-08-21 17:33         ` Junio C Hamano
  2007-08-21 18:50           ` Robin Rosenberg
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2007-08-21 17:33 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: Miklos Vajna, git

Robin Rosenberg <robin.rosenberg.lists@dewire.com> writes:

> How about this instead:
>
> -- robin
>
> Include diff options into git-show command manual

I think that is probably a good idea but I wonder if placing
diff-options in between of pretty-options and pretty-formats is
a good idea.

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

* Re: [PATCH] Document the -p option for git-show.
  2007-08-21 17:33         ` Junio C Hamano
@ 2007-08-21 18:50           ` Robin Rosenberg
  0 siblings, 0 replies; 11+ messages in thread
From: Robin Rosenberg @ 2007-08-21 18:50 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Miklos Vajna, git

tisdag 21 augusti 2007 skrev Junio C Hamano:
> Robin Rosenberg <robin.rosenberg.lists@dewire.com> writes:
> 
> > How about this instead:
> >
> > -- robin
> >
> > Include diff options into git-show command manual
> 
> I think that is probably a good idea but I wonder if placing
> diff-options in between of pretty-options and pretty-formats is
> a good idea.

Since pretty-formats is a new section in the man page it works out fine. I
actually ran make and man to verify this patch.

-- robin

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

end of thread, other threads:[~2007-08-21 18:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-19  0:42 Getting a file revision Bahadir Balban
2007-08-19  0:52 ` Junio C Hamano
2007-08-20 11:38   ` Jerome Lovy
2007-08-21 12:49     ` [PATCH] Document the -p option for git-show Miklos Vajna
2007-08-21 13:09       ` Johannes Sixt
2007-08-21 14:29         ` VMiklos
2007-08-21 15:02         ` David Kastrup
2007-08-21 17:01       ` Robin Rosenberg
2007-08-21 17:33         ` Junio C Hamano
2007-08-21 18:50           ` Robin Rosenberg
2007-08-19  0:52 ` Getting a file revision J. Bruce Fields

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