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

Re: git diff-tree against the root commit

From
Christoph Mallon <christoph.mallon@gmx.de>
Date
Nov 7, 2010, 10:58 UTC
Message-ID
<4CD68662.4060709@gmx.de>
In-Reply-To
<4CCA6623.8090705@workspacewhiz.com>
On 29.10.2010 08:13, Joshua Jensen wrote:
Show 7 quoted lines
> I am mirroring a Git repository into another SCM.  I am using 'git diff-tree' to tell me what changes I need to make to the other SCM.
> 
> Today, I attempted to mirror a new submodule.  'git diff-tree' reported two SHAs... 0000000000000000000000000000000000000000 and the revision the submodule currently resides at.  I attempted to run a 'git diff-tree' within the submodule for the all zero SHA and the revision specified, but apparently, 0000000000000000000000000000000000000000 does not really represent the root commit and does not work.  I then discovered the --root option, but that doesn't seem to give me the complete file list either.
> 
> 'git diff-tree' has been working great for everything else, but I really need a root commit diff-tree listing for proper automation.
> 
> What are my options?
Diff against the empty tree. This gives you the treeish of the empty tree:
	git mktree < /dev/null
The result is 4b825dc642cb6eb9a060e54bf8d69288fbee4904. This magic number is used in git in several places. git's behaviour with parentless commits is somewhat annoying and/or broken.
Previous: Joshua JensenNext: Linus Torvalds
Message 2 of 3 in “git diff-tree against the root commit”
  1. Joshua JensenOct 29, 2010
  2. Christoph MallonNov 7, 2010
  3. Linus TorvaldsNov 7, 2010

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.