Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • jQuery
  • AngularJS
  • ReactJS
  • Next.js
  • React Native
  • NodeJS
  • Express.js
  • MongoDB
  • MERN Stack
  • PHP
  • WordPress
  • Bootstrap
  • Tailwind
  • CSS Frameworks
  • JS Frameworks
  • Web Development
Open In App
Next Article:
How to Use Git Log to Format the Commit History?
Next article icon

How to Use Git Log to Format the Commit History?

Last Updated : 30 May, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The commit history in a Git repository serves as a timeline of changes, documenting the evolution of a project over time. While Git's default commit history display provides important information, customizing the format of the commit log can offer deeper insights and improve readability.

Git's powerful git log command allows you to use the presentation of commit history to suit your preferences and requirements. In this article, we'll explore how to use git log to format the commit history effectively, enabling you to gain better visibility into project changes and streamline collaboration.

What is Git Log? 

git log command is used to view the list of commit logs. The data is represented in a reverse log manner, i.e., showing the recent ones at the top and others at the bottom. The log contains details about the timestamp of the commit, the author of the commit, the branch on which the commit was made, the SHA(Secure Hash Algorithm) ID of the commit, and the commit message.

Formatting Commit History

Git provides a range of options to customize the format of the commit history displayed by git log. These options allow you to specify which commit metadata to include, how it should be formatted, and even add custom elements to the output.

The various options to format the git log are as follows: 

--author=<Name>

It helps to format the log for those commits only where the author was a specific user. This option helps to review any logs made by any specific user overtime on a repository.

--since=<Date> / --after=<Date>

These options help to format the log based on the timestamps and query only those commit logs which fulfill the criteria.

-n <number>

The -n option helps to limit the log commits view, i.e. only a certain number of recent commits will be displayed instead of showing a bulk of updates.

--grep=<pattern>

The --grep options help the user to search for a particular pattern or word in the whole commit history and display on those commits which consist of the pattern. This option is useful when a user is looking for updates related to a specific file or object.

--graph

The --graph option displays the updates in a graphical format, displaying the branching and the merging commits as diverging and converging graph nodes. Each commit is actually a graph node in the log graph.

--oneline

The - -oneline option is used to format the commit log in as compact as much possible way.

--all

The --all option is used to view the commit log of all branches in a single log.

Note: Although, there are various options to format the log messages. The most useful options are the above-listed ones.


Next Article
How to Use Git Log to Format the Commit History?

P

pandeyashutosh150799
Improve
Article Tags :
  • Web Technologies
  • Git
  • Geeks Premier League
  • Geeks-Premier-League-2022

Similar Reads

    How To Get The Git Commit Count?
    Tracking the number of commits in your Git repository can provide insights into the development progress, team activity, and overall project health. Whether you want to get the total commit count or see the number of commits by each contributor, Git offers several ways to retrieve this information.
    2 min read
    How To Update The Date Of An Old Commit In Git?
    Changing the date of a commit in Git is not a common practice, but it can be necessary in certain situations. For example, you might need to correct the timestamp of a commit for compliance reasons, to reflect the actual time work was done, or to fix an error. This process involves rewriting Git his
    3 min read
    How to Search Through Committed Code in Git History Using Grep?
    Searching through the history of committed code in a Git repository is an important skill for developers. It allows you to track changes, find the introduction of bugs, understand the evolution of the codebase, and more. One powerful tool that provides this process is grep, a command-line utility fo
    1 min read
    Git - Filtering the Commit History
    Git source code versioning tool provides a lot of features. One of the most important and useful features is log or history. We can use git log command in order to list, filter, view commit history in different ways. Here we will examine git log command usage in detail with examples. List Commit His
    4 min read
    How To Search All Of Git History For A String?
    Searching through Git history can be important for debugging, auditing, or understanding code changes. Git offers powerful tools to search the entire history of a repository for specific strings or patterns, even if they have changed across different commits. This article explores various methods to
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences