Skip to content

Commit 5990efb

Browse files
author
Junio C Hamano
committed
tutorial: update the initial commit example.
Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 2ae6c70 commit 5990efb

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Documentation/tutorial.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,16 @@ also wants to get a commit message
293293
on its standard input, and it will write out the resulting object name for the
294294
commit to its standard output.
295295

296-
And this is where we create the `.git/refs/heads/master` file. This file is
297-
supposed to contain the reference to the top-of-tree, and since that's
298-
exactly what `git-commit-tree` spits out, we can do this all with a simple
299-
shell pipeline:
296+
And this is where we create the `.git/refs/heads/master` file
297+
which is pointed at by `HEAD`. This file is supposed to contain
298+
the reference to the top-of-tree of the master branch, and since
299+
that's exactly what `git-commit-tree` spits out, we can do this
300+
all with a sequence of simple shell commands:
300301

301302
------------------------------------------------
302-
echo "Initial commit" | \
303-
git-commit-tree $(git-write-tree) > .git/refs/heads/master
303+
tree=$(git-write-tree)
304+
commit=$(echo 'Initial commit' | git-commit-tree $tree)
305+
git-update-ref HEAD $(commit)
304306
------------------------------------------------
305307

306308
which will say:

0 commit comments

Comments
 (0)