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

Chapter 7: Enhancing your robot

Git log

face Josiah Wang

Now that you have updated and committed your robot project to your repo so many times, perhaps you would like to reminisce about how your robot has grown since its birth? πŸ‘ΆπŸ½

Since git is a version control system, naturally you will be able to examine your commit history.

To do this, use git log.

user@MACHINE:~/robot$ git log
commit commit 0ebdde47c38575f8583e7f1134e538e98c39bf03 (HEAD -> master)
Author: Josiah Wang <my.email@imperial.ac.uk>
Date:   Fri Jul 9 16:59:34 2021 +0100

    Improved robot in main.py so that the robot automatically navigates to cell (9,9) for its Ribena.

commit 47a4835686e11dc946bce797d56196b6624b2842
Author: Josiah Wang <josiah.wang@imperial.ac.uk>
Date:   Fri Jul 9 16:44:22 2021 +0100

    Improved robot in main.py so that it automatically rotates 90 degrees clockwise whenever it hits a wall.

commit a73ea840aa3ec9526eb0cfb5830b9d5b739978a6
Author: Josiah Wang <josiah.wang@imperial.ac.uk>
Date:   Fri Jul 9 16:28:50 2021 +0100

    Improved robot in main.py so that it automatically moves forward in the same initial direction until it hits a wall.

...

The log should be self-explanatory.

The long sequence of number is the git hash that acts as a unique ID for each of your commit. You will be able to navigate to your different commits using this hash. We will do this in future lessons, but for now, enjoy seeing how your robot has grown! πŸ‘Ά

(HEAD -> master) is the pointer to where you currently are. We will discuss more about this in the next lesson.

Also try git log --oneline for a more compact version of your history.

And try git log -5 if you only want to view your latest 5 commits.

You can also try git log -p (short for --patch) to see the difference in your code between two commits of your main.py.

You can find my own implementation of the robot project here at this link. More specifically, this is a snapshot of the specific commit from my own repo (note the long commit hash ID). Remember, my implementation is not the only possible solution!