Level 4

Log & status

Use Git's log to see your commit history, and check the status of your working directory.

Level 3 was tough. Level 4 will give you a little break. This level is about examining the pages in your scrapbook and the mementos on your tabletop, with two commands that help you get your bearings in any repository: git log and git status.

Step 1 of 4
0 xp

Flip through the pages

Git's log lets you flip back through your scrapbook and see each page in order, along with who added it and when. git log walks back from HEAD through each page's parent and lists them, newest first.

Type this into the terminal below
git log

If you have used git log in a terminal, you have probably seen a wall of confusing text. That is exactly what you get there. Here, the commit history drawn as circles connected by arrows literally is the log. Abstract Git concepts, rendered right in front of your eyes.

safe 'log' only reads; nothing in the repository changes.

The working directory

Now forget about logs and commits for a second and focus on the mementos sitting on your tabletop. The tabletop you work on, and the mementos sitting on it, is what Git calls the working directory.

It is often useful to check what is going on there. Maybe you have new mementos, maybe some have changed, maybe some are arranged on the mat and ready to be stuck into the book.

Look at the table

git status gives you the same information as the wall of three columns. It shows exactly what is on your tabletop and what is prepped for the scrapbook.

Type this into the terminal below
git status

Right now all three columns are empty: no new files, no changes, nothing staged. Your tabletop is totally clear. Congratulations on having such a clean working directory, not a file or memento in sight.

safe 'status' only reads; nothing in the repository changes.

The safest commands you own

git log and git status are purely informational. They provide useful insight about the current state of your repository and change nothing behind the scenes.

When you are not sure what is going on, or what a command is about to do, run these first. There is no situation in which they make things worse. Told you this would be an easy one.

git-sim
Initial CommitDevlands

The graph appears here when the first command runs. The simulations are drawn by git-sim from a real repository.

The scrapbook · one picture for every Git idea

The scrapbook picture appears as the story is told.