git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Extracting a single commit or object

From
Shawn O. Pearce <spearce@spearce.org>
Date
Dec 30, 2008, 22:21 UTC
Message-ID
<20081230222106.GE29071@spearce.org>
In-Reply-To
<21223948.post@talk.nabble.com>
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.
Previous: yitzhakbgNext: Alex Riesen
Message 2 of 6 in “Extracting a single commit or object”
  1. yitzhakbgDec 30, 2008
  2. Shawn O. PearceDec 30, 2008
  3. Alex RiesenJan 1, 2009
  4. Johannes SchindelinJan 1, 2009
  5. Miklos VajnaJan 1, 2009
  6. Johannes SchindelinJan 2, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.