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

Chapter 9: Git

git init

face Josiah Wang

Have you installed git on your computer? Great. Let us move on!

You will now convert your robot project into a git repository.

On the command line, navigate to the directory of your robot project.

So, if you named your directory robot, then you should cd to robot. You should see main.py that you created earlier in the current directory.

Now, run git init to turn this directory into a git repository.

user@MACHINE:~$ cd robot
user@MACHINE:~/robot$ git init
Initialized empty Git repository in /home/user/robot/.git/

If you have done this correctly, you should see a new .git subdirectory inside your robot directory. If you are on Linux/macOS, you will have to add the -a flag to ls -la to reveal the hidden directory.

All git magic will happen inside this .git folder. You do not need to know or understand what is inside this folder. If you ever delete this .git folder, all the magic will cease to exist. Your robot directory will return to being a normal directory, and you will lose all your change history and previous versions of your files. 😭