Viewing the log

You have been making changes and religiously adding great descriptive comments for each commit, this is going to really help you when it comes to understanding a change you made a while ago, or some files added by a co-worker.

 

Let's take a look at the log

  • Open the command line and get to the project folder

  • type in git log to see the log of every action you have taken

  • Press enter or the down arrow to scroll through the list

  • Reached the end? Press q to get back to the command line

Showing the Git log

The comments are great, but you might notice that they don’t have much information other than what you have mentioned yourself. Wouldn't it be great if you could see the names of files added or deleted etc?

Go back to the command line and instead of typing git log, type git log -p, now you will see the difference between the branch before the commit and after the commit.

Here’s yet another version, get back to the command line and type git log –stat –summary. You will now see the log with an overview of the changes you have made.

Don’t forget to escape from the log and get back to the command line you press q.

 

What did I just learn?

  • The log file contains every change made to your projects

  • View every comment you made with git log

  • View the log including the difference between each change with git log -p

  • View an overview of each change including the file names involved with git log –stat --summary

 

Tags

Git log
Git comments
Guide

Add new comment

CAPTCHA
Answer the below question to help us fight spam

What is 2 + 2?