DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Securing Your Software Supply Chain with JFrog and Azure
Register Today

Trending

  • Introduction to Domain-Driven Design
  • Database Integration Tests With Spring Boot and Testcontainers
  • Introduction to API Gateway in Microservices Architecture
  • The SPACE Framework for Developer Productivity

Trending

  • Introduction to Domain-Driven Design
  • Database Integration Tests With Spring Boot and Testcontainers
  • Introduction to API Gateway in Microservices Architecture
  • The SPACE Framework for Developer Productivity
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Counting Duplicate Commit Messages

Counting Duplicate Commit Messages

Offer constructive feedback to your colleagues on duplicate commit messages.

Lorna Mitchell user avatar by
Lorna Mitchell
·
Jan. 06, 20 · Tutorial
Like (4)
Save
Tweet
Share
3.88K Views

Join the DZone community and get the full member experience.

Join For Free

When chatting about source control best practices the other day, I was asked about repeated Git commit messages. In general, I would always advise that receiving the same commit messages appearing multiple times in a project's history is a definite red flag — and if I'm responsible for that repository, I will probably make fun of you for doing it.

Workplace harassment aside, if you can repeat your commit messages, then they are probably not descriptive enough. There are always projects that break this rule for some reason, but in all the years I've worked in software, I have never worked on a project where I'd make an exception for something like that.

You may also like: How (And Why!) to Keep Your Git Commit History Clean

To support my point, I also checked one of the larger repos at work for duplicate commit messages. It was simple to do but I thought I'd share my script in case anyone else wants to use it on their own repos and offer constructive feedback to their own colleagues!

Shell




x


 
1
git log --oneline | cut -c 10- | sort | uniq -c | sort -n



This shows every commit message in the history of the project, with a count of how many times it appears — and it sorts them by that count (increasing, so that the most repeated messages appear immediately above your cursor when the command completes).

Typically, I do see quite a few "Merge branch master into ...." type messages, and we also have some automation that produces some very similar messages — all that is fair enough. When I find the person who thinks that "Update [filename]" is an acceptable commit message though, I will be taking some time to ~ point and laugh ~ offer some constructive advice.

Further Reading

Learning Git: What Is a Commit?

How (And Why!) to Keep Your Git Commit History Clean

Commands and Operations in Git

Commit (data management)

Published at DZone with permission of Lorna Mitchell, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Introduction to Domain-Driven Design
  • Database Integration Tests With Spring Boot and Testcontainers
  • Introduction to API Gateway in Microservices Architecture
  • The SPACE Framework for Developer Productivity

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: