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

Re: need to create new repository initially seeded with several branches

From
Iin-git-vger@baka.org <in-git-vger@baka.org>
Date
Aug 31, 2011, 16:21 UTC
Message-ID
<201108311621.p7VGLDlm015261@no.baka.org>
In-Reply-To
<CAKjsY4nsPNO_kvxeime8qcNrRFykgG2TOYxJ0HKbj2zR5Rwv+Q@mail.gmail.com>
In message <CAKjsY4nsPNO_kvxeime8qcNrRFykgG2TOYxJ0HKbj2zR5Rwv+Q@mail.gmail.com>, Ryan Wexler writes:
    > # Cause git to delete all files in the internal index
    > git read-tree --reset -i 4b825dc642cb6eb9a060e54bf8d69288fbee4904
    > # Cause git to delete all files in the working directory
    > git clean -dfx
    > The only "magic" is the read-tree/git-clean stuff.  The 4b82…
    > value is the SHA of an empty tree.  It could be replaced by
    > a:
    >
    > find . -maxdepth 1 ! -name '.git' -a ! -name '..' -a ! -name '.' -print0 | xargs -0 rm -rf
    I have to say that I am lost by the "magic" you describe.  I don't
    understand what you mean by the 4b82... value should be replaced by
    the find | xargs remove all command.   That command looks like it just
    deletes all the "." file names?  But when you say replace I thought
    you would mean I need to generate a new value to replace that magic
    number??  Confused...

I was just trying to explain what the git-read-tree and git-clean commands are doing. The long string starting with 4b825d is a special SHA that git knows represents an empty tree. I was saying that you *could* (not should) replace the two commands (git-read-tree and git-clean) with the "find | xargs rm" command I quoted. The two sets of commands are equivalent.

Also, if you look at the find command, I am finding everything *except* the .git . and .. directories

					-Seth Robertson
Previous: Ryan WexlerNext: Johannes Sixt
Message 4 of 11 in “need to create new repository initially seeded with several branches”
  1. ryan@iridiumsuite.comAug 31, 2011
  2. in-git-vger@baka.orgAug 31, 2011
  3. Ryan WexlerAug 31, 2011
  4. in-git-vger@baka.orgAug 31, 2011
  5. Johannes SixtAug 31, 2011
  6. Brandon CaseyAug 31, 2011
  7. Jeff KingAug 31, 2011
  8. Brandon CaseyAug 31, 2011
  9. Ryan WexlerAug 31, 2011
  10. Brandon CaseyAug 31, 2011
  11. Brandon CaseyAug 31, 2011

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.