News Stay informed about the latest enterprise technology news and product updates.

Five git log oneline examples

The default git log command doesn’t provide the most visually pleasing results. The output is bulky and can make inspecting the commit history cumbersome. The solution? Use the –pretty=oneline switch whenever you need to view the git log.

The oneline switch is the default for the reflog command, so it should feel familiar:

git log oneline

Git log oneline example

git log --pretty=oneline

You can actually don’t need to prepend -pretty to the oneline switch, as there’s a built in alias for the command:

git log --oneline

Visualize branches with git log graph

A nice addition to the oneline switch is the –graph option. This creates a visual depiction of branch creation, checkouts and merges.

git log --oneline --graph
git squash commit branch id

The git log graph allows you to visualize branches.

To include extra data about all branches, commits and authors in the graph you can add the decorate and all switches:

git log –all –decorate –oneline –graph

All of the features of the pretty switch are available to the git log command when online is used, so if you really want to get crazy, you can include a variety of customization to the rendering of the log as well:

git log --graph --pretty="%C(yellow) Hash: %h %C(blue)Date: %ad %C(red) Message: %s " --date=human

The git log is the window into your organization’s workflow and development history. Being able to format the output with git log –oneline switch will help save you time when the need arises to inspect your Git commit history.

 

 

 

 

Join the conversation

2 comments

Send me notifications when other members comment.

Please create a username to comment.

How are you using an operational data store in your organization?
Cancel
agreed, ODS is a big undertaking. It may make sense for companies which have to undergo major technology renewal (do I have to mention Health Insurance Companies with IT systems built half a century ago?)
Cancel

SearchAppArchitecture

SearchSoftwareQuality

SearchCloudComputing

SearchSecurity

SearchAWS

Close