6. Inspecting A Repository

6.1. Inspecting The Log

Of course, Git provides a nice interface to show all changes:

git log

Hint

Please note this is only the most basic command and there are many options to customise the output. The most useful ones are:

  • --oneline: Show log as compact as possible

  • --graph: Draw a text-based graphical representation of the commit history

  • --decorate: Print out the ref names on any commits that are shown

I usually use the following git logg alias:

logg = log --graph --abbrev-commit --decorate --format=format:'%C(bold cyan)%h%C(reset) - %C(yellow)[%ar]%C(reset) %C(white)%s%C(reset)%C(green bold)%d%C(reset) %C(dim white)- %aN%C(reset)'

6.2. Inspecting A Commit

To inspect a single commit, you can use the following command with a SHA hash of a commit, respectively of the log:

git show {COMMIT}

Hint

There are other ways to reference a Git object such as a commit. Feel free to have a look at Revisions for more advanced reference methods.

6.3. Blaming

Note

After completing this chapter, you should be able to execute the Inspector Gitget exercise.