This is an archived version of the course. Please find the latest version of the course on the main webpage.

Chapter 9: Git

git status

face Josiah Wang

Now that you have created your repository, run git status to inspect it. You should see something similar to the output below.

user@MACHINE:~/robot$ git status
On branch master

No commits yet

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

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

The output basically says:

  • You have not yet saved any files into the git repository (No commits yet).
  • There is a file called main.py in the working directory that has not been saved to the repository (Untracked files).

To really help your understanding, you need to think of two ‘areas’ or ‘sections’ in a Git project:

  1. Git repository (the .git subdirectory)
  2. The working directory (your robot directory)

The 'sections' of a Git project

The Git repository stores snapshots for every commit (save) that you make to the repository. Git will have some way of keeping the files compressed inside .git, for example by not duplicating files that have not been modified. Think of this as your ‘database’.

The working directory contains the files themselves that you can use or modify, or any additional files that the Git repository are not tracking.

At the moment, your Git repository is empty. So Git is not yet tracking any changes to your main.py file.

You will add the file to the Git repository in a later lesson. For now, make sure you understand what we have discussed so far. You may find things confusing later otherwise.