Skip to content

git status#

The status sub-command checks the current directory and if it's a Git repository, it will report on its status. If the current directory is not a Git repository, then Git will traverse the filesystems, going through all the .. links, checking to see if a parent directory is a Git repository.

Once it finds a repository, we'll get a report on the status of the repository:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
$ git status
On branch master

No commits yet

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

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

So, we have "no commits yet", which is true, and a single "untracked file": hello.txt.

A Git repository tracks changes between commits. Right now, we have none, so there is no comparison to be made because there's nothing to compare to.

To create a commit, we have first have to add our hello.txt file to the repository's staging area.

That's what the git add command is for. Let's look at it next.