-1

I've got three files with me:

git add . 

And

git commit -m "bla blah blah"

Unfortunately, I don't see one, git tree. When git create tree? There is a rule for this?

with:

$ git cat-file -p master^{tree}

i only see:

blobs

[Ubuntu-1604-xenial-64-minimal]mars~/git29012019[0]> git cat-file -p master^{tree}
100644 blob 39f7cb850446bb67a198a4df484aa627b4907be4    hallo.txt
100644 blob 7fcd1b9ac1bf7d3544297b177de51bb1fe4891dc    heute.txt
100644 blob d2606d4f699dafaf905b1645dcd04e767623622b    meins.txt

when is a tree created? when git create tree? Thanks

Hendrik
  • 65
  • 3
  • 2
    Please explain what you're really asking here. There is an internal data structure known as a tree object that holds the directory structure of the repository, related to commits, is this what you're asking about? If so then tree objects are created whenever you commit. – Lasse V. Karlsen Jan 30 '19 at 15:27
  • Possible duplicate of [Unable to show a Git tree in terminal](https://stackoverflow.com/questions/1064361/unable-to-show-a-git-tree-in-terminal) – leopal Jan 30 '19 at 15:27
  • Maybe [this post](https://stackoverflow.com/questions/1064361/unable-to-show-a-git-tree-in-terminal) will help. – Leonardo Alves Machado Jan 30 '19 at 15:28
  • 1
    This is a different tree, a tree of commits. The OP asked about [tree object](https://git-scm.com/book/en/Git-Internals-Git-Objects#_tree_objects) attached to commit. – phd Jan 30 '19 at 18:11

1 Answers1

2

Git create the tree objects when you do a git commit.

Before that, the tree objects are temporary stored in the index file and its hash is filled in the commit object later when you create it.

Philippe
  • 28,207
  • 6
  • 54
  • 78
  • 2
    Git doesn't create a tree when you run `git add` but it creates a tree from the index on running `git commit`. – haccks Aug 27 '21 at 04:08