git write-tree

CommandNew filesChanged filesDeleted files
Alice/> git init
Initialized empty Git repository in /home/rene/github/github/git-internals/repos/write-tree/Alice/.git/
snap no: 1

First, Alice creates two files: foo-bar-baz.txt and …

Alice/> printf "foo\nbar\nbaz"   > foo-bar-baz.txt
snap no: 2

… one-two-three.txt.

Alice/> printf "one\ntwo\nthree" > one-two-three.txt
snap no: 3

She adds both files to the index:

Alice/> git update-index --add *.txt
snap no: 4

She also creates a third file …

Alice/> printf "eggs\nwhy\nz.\n" > xyz.txt

… that is not added to the index.

snap no: 5

Alice creates a tree object from the files on the index.

Alice/> git write-tree
582a0898b5598958f3234e058338eb349e12fa39
snap no: 6