When you are working on a project, it is important to keep track of the changes that have been made. This can be done by keeping a Git log of all the changes that have been made to your project. This can be used to see what changes were made, when they were made, and how they affected the project. To view the Git log of a project, you first need to create a new Git repository. Then, you can clone the repository and use git clone to create a new directory inside of it. In this directory, you will need to create a file called .gitignore and put in the following content: *.txt *.log This will tell Git that any files that are not meant for public view should be kept in this directory instead. Next, you will need to install Git. You can do this by running sudo apt-get install git . Once installed, you can use git as follows: git config –global user.name “Your Name” git config –global branch “master” git config –global working_directory “.” git config –global push origin master


Git tracks commits over time, allowing you to follow the progression and history of your code. While you can always use Github online to view the public repository, navigating your local repo requires the use of CLI tools to view the Git commit history, like git log.

The Non-CLI Solution: Just Use a Git Client

While you should definitely learn to use Git from the command line, as it helps to understand everything you’re doing, this is one of the few times where it really does just make more sense to have a proper interface for viewing Git history, especially when you take into account multiple branches, remotes, tags, and contributors. The experience of using online services like GitHub is clearly beneficial, so why not have it on the desktop?

There are a lot of Git GUI clients out there, but the most notable ones are Github Desktop, GitKraken, Fork, and SourceTree.

However, it’s still useful to learn the commands. You might not want to use a GUI, or you may be in a remote environment over SSH, or you may just want a quick peek while you’re already at your terminal. Luckily, using git log is fairly easy.

Using git log

By default, git log shows a lot of info about each commit—the ref ID, the author, the date, the commit message, and if it’s the HEAD of any branches.

If you’d like to know what files are affected, you’ll need to run it with –stat, which will display a list of files with additions and deletions.

If you’d like to know what actually changed in these commits, you’ll need to run it with -p, which can be used with or without –stat:

This can be a lot to filter through, so you can sort by date:

Or view by affected file:

Or with a search string:

Or view important merge commits:

And, if you just want to view the changes of a single commit from the log, you can copy the hash and run git show:

Viewing Branch History

Just having a list of commits can be messy to sort out branches. Luckily git log provides the –graph option which can be used alongside some

You can also use custom formatting if you don’t like the look of this:

This particular set of parameters is quite useful, but there isn’t a shorthand for it, so if you use this a lot, we recommend setting an alias in ~/.bashrc, or whatever equivalent config you use for your shell:

RELATED: How to Create Aliases and Shell Functions on Linux