'"No commits yet" versus expected "Initial commit"

I am currently working through David Demaree's book "Git for Humans" from the "A Book Apart" series. I am using windows 7 and Git Bash to follow along.

So far, I have followed along with the following steps:

On my desktop, I have made a directory:

$: mkdir our-website

I then cd'ing into the "our-website" directory context... following the instructions I ran 'git init':

$: git init

The output that I got was as expected according to the book:

$: git init
Initialized empty Git repository in C:/Users/Andy/Desktop/our-website/.git/

At this point, everything is fine, and it matches up... Though after entering the next command (git status) as outlined in the book my output from Git Bash is different.

Here's what I get:

$ git status
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        index.html

nothing added to commit but untracked files present (use "git add" to track)

This doesn't match up with the expected output that is presented in the book, which is:

(master *) $: git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
# index.html
nothing added to commit but untracked files present
(use "git add" to track)

As you can see the line in my output in the first example state "No commits yet"... while the output in the book example states "Initial commit".

I was wondering why this is. Maybe this is a small inconsequential concern, but I'm not sure. I'd appreciate any help in understanding this. Thanks.

git


Solution 1:[1]

git status is a convenience command, it changes as the devs find better ways, and it used to say Initial commit when there wasn't a commit yet. It was changed about five years ago, for Git 2.14, to its current text.

I found this by saying git log --grep 'Initial commit', and then git describe --contains 7e46f19a, in the git history.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jthill