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

Chapter 5: Making a git commit

Git add

face Josiah Wang

First let us add main.py to the staging area.

Type git add main.py into the command line.

user@MACHINE:~/$ cd robot
user@MACHINE:~/robot$ git add main.py
user@MACHINE:~/robot$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
        new file:   main.py

If you type git status (something you should always do), you can see that main.py is currently in the staging area, and is waiting to be committed to the repo.

Adding main.py to the staging area

git status also tells you how to remove the file from the staging area (“unstage”). You may try it if you wish (git rm --cached main.py). Just remember to add main.py back to the staging area once you’re done before proceeding further.