Lesson 3
Discovering your Paths
Chapter 5: Making a git commit
Git commit
Now that you have added main.py
to the staging area, it is time to commit the files to your Git repository.
Committing your files means adding or saving all the files currently in the staging area to the repository. The files might be new, or might be existing files that you have modified.
A single commit is one update to your project.
Commit message
You will need to provide a commit message. This will be a description of the changes that you have made.
Try to make this message useful, informative, and specific:
"I finally finished my code! Time for bed! Zzzz..."
is pointless, although cute. ❌"New update"
is useless. We know that this is an update. ❌"Updated main.py"
is uninformative. We can easily figure this out from Git. ❌"Updated the function draw() in main.py to produce a more accurate visualisation"
is perfect. ✔️
Commit your files
Type git commit -m "Your commit message"
to commit the files in the staging area to the repo.
If done correctly, your output should look something like below.
user@MACHINE:~/robot$ git commit -m "First version of the robot project"
[master (root-commit) 4255778] First version of the robot project
1 file changed, 6 insertions(+)
create mode 100644 main.py
Now, check the status of your repo. Have you memorised how to do this by now?
user@MACHINE:~/robot$ git status
On branch master
nothing to commit, working tree clean
Perfect, this says that the files in your working directory (“working tree”) is identical to the files tracked in the repository.
Your robot project is now a working Git repository, with a single file main.py
! Great work!