git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Extracting a single commit or object
@ 2008-12-30 22:15 yitzhakbg
  2008-12-30 22:21 ` Shawn O. Pearce
  2009-01-01 16:52 ` Johannes Schindelin
  0 siblings, 2 replies; 6+ messages in thread
From: yitzhakbg @ 2008-12-30 22:15 UTC (permalink / raw)
  To: git


How would I extract a single commit from a repository by it's SHA1 (or any
other treeish)?
For that matter, how is any one single object extracted? Examples please.
Thanks,
YBG
-- 
View this message in context: http://www.nabble.com/Extracting-a-single-commit-or-object-tp21223948p21223948.html
Sent from the git mailing list archive at Nabble.com.

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

* Re: Extracting a single commit or object
  2008-12-30 22:15 Extracting a single commit or object yitzhakbg
@ 2008-12-30 22:21 ` Shawn O. Pearce
  2009-01-01 22:06   ` Alex Riesen
  2009-01-01 16:52 ` Johannes Schindelin
  1 sibling, 1 reply; 6+ messages in thread
From: Shawn O. Pearce @ 2008-12-30 22:21 UTC (permalink / raw)
  To: yitzhakbg; +Cc: git

yitzhakbg <yitzhakbg@gmail.com> wrote:
> 
> How would I extract a single commit from a repository by it's SHA1 (or any
> other treeish)?
> For that matter, how is any one single object extracted? Examples please.

git cat-file $type $sha1

e.g.

git cat-file commit $commitsha1
git cat-file blob $blobsha1

If you need to inspect a tree, ls-tree is probably better:

git ls-tree $commitsha1
git ls-tree $treesha1

-- 
Shawn.

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

* Re: Extracting a single commit or object
  2008-12-30 22:15 Extracting a single commit or object yitzhakbg
  2008-12-30 22:21 ` Shawn O. Pearce
@ 2009-01-01 16:52 ` Johannes Schindelin
  2009-01-01 18:08   ` Miklos Vajna
  1 sibling, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2009-01-01 16:52 UTC (permalink / raw)
  To: yitzhakbg; +Cc: git

Hi,

On Tue, 30 Dec 2008, yitzhakbg wrote:

> How would I extract a single commit from a repository by it's SHA1 (or 
> any other treeish)?

Your question is not precise enough to answer.  Are you looking for

- the commit message?
- the patch?
- all the files referenced by that commit?
- all the files _and revisions_ referenced by that commit?

The answer depends quite a lot on the question...

> For that matter, how is any one single object extracted? Examples please.

The user-friendly way to look at a tree is

	git show HEAD:Documentation/

or some such.  Likewise, you can inspect single blobs like this:

	git show HEAD:README

If you activated bash completion, you can even complete monsters like 
this:

	git show \
v1.5.3:v1.5.3:t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master

Hth,
Dscho

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

* Re: Extracting a single commit or object
  2009-01-01 16:52 ` Johannes Schindelin
@ 2009-01-01 18:08   ` Miklos Vajna
  2009-01-02 17:37     ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Miklos Vajna @ 2009-01-01 18:08 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: yitzhakbg, git

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

On Thu, Jan 01, 2009 at 05:52:49PM +0100, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> If you activated bash completion, you can even complete monsters like 
> this:
> 
> 	git show \
> v1.5.3:v1.5.3:t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master

Wow, that's really a monster. After removing the first leading v1.5.3:,
it works. (If this is a bash completion bug, I can't reproduce.)

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

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

* Re: Extracting a single commit or object
  2008-12-30 22:21 ` Shawn O. Pearce
@ 2009-01-01 22:06   ` Alex Riesen
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Riesen @ 2009-01-01 22:06 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: yitzhakbg, git

2008/12/30 Shawn O. Pearce <spearce@spearce.org>:
> yitzhakbg <yitzhakbg@gmail.com> wrote:
>>
>> How would I extract a single commit from a repository by it's SHA1 (or any
>> other treeish)?
>> For that matter, how is any one single object extracted? Examples please.
>
> git cat-file $type $sha1
>

git cat-file -p $sha1

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

* Re: Extracting a single commit or object
  2009-01-01 18:08   ` Miklos Vajna
@ 2009-01-02 17:37     ` Johannes Schindelin
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Schindelin @ 2009-01-02 17:37 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: yitzhakbg, git

Hi,

On Thu, 1 Jan 2009, Miklos Vajna wrote:

> On Thu, Jan 01, 2009 at 05:52:49PM +0100, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > If you activated bash completion, you can even complete monsters like 
> > this:
> > 
> > 	git show \
> > v1.5.3:v1.5.3:t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master
> 
> Wow, that's really a monster. After removing the first leading v1.5.3:, 
> it works. (If this is a bash completion bug, I can't reproduce.)

Heh, it's just another proof that copy-n-paste ist just error-prone.

Thanks,
Dscho

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

end of thread, other threads:[~2009-01-02 17:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-30 22:15 Extracting a single commit or object yitzhakbg
2008-12-30 22:21 ` Shawn O. Pearce
2009-01-01 22:06   ` Alex Riesen
2009-01-01 16:52 ` Johannes Schindelin
2009-01-01 18:08   ` Miklos Vajna
2009-01-02 17:37     ` Johannes Schindelin

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