Add daily email for 2024-05-21
Which commit has the largest message?
This commit is contained in:
parent
e6b90e6344
commit
f15ea5343f
29
source/_daily_emails/2024-05-21.md
Normal file
29
source/_daily_emails/2024-05-21.md
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
title: Which commit has the largest message?
|
||||||
|
date: 2024-05-21
|
||||||
|
permalink: daily/2024/05/21/which-commit-has-the-largest-message
|
||||||
|
tags:
|
||||||
|
- software-development
|
||||||
|
- git
|
||||||
|
cta: ~
|
||||||
|
snippet: |
|
||||||
|
Which commit in your Git repository has the largest commit message?
|
||||||
|
---
|
||||||
|
|
||||||
|
[I write and advocate for others to write][0] detailed Git commit messages within the subject body to provide context and information about why the commit was needed, what other options were considered, any consequences or knock-on effects there could be, or even code snippets or pseudo code.
|
||||||
|
|
||||||
|
Recently, I was curious to know which commit in a repository has the longest commit message, what code has changed in that commit, and who wrote it.
|
||||||
|
|
||||||
|
I was hoping for a command like `git shortlog --summary --all` (which shows all authors to a codebase and their number of commits), but couldn't find one, so [I wrote a script to do it][1].
|
||||||
|
|
||||||
|
It's a bash script that loops over the commits in the repo, calculates the length of each message, sorts them and shows the commit with longest message.
|
||||||
|
|
||||||
|
It was an interesting task and shows examples of using various UNIX commands and Linux coreutils, such as `find`, `cut`, `sort` and `wc` in combination with Git.
|
||||||
|
|
||||||
|
The longest in this website's code base is [546 characters][2], which is fairly small compared to some of my messages in other projects.
|
||||||
|
|
||||||
|
What's the longest commit message in the repository you're working in?
|
||||||
|
|
||||||
|
[0]: {{site.url}}/daily/2024/05/17/why-i-dont-commit-with--m
|
||||||
|
[1]: https://github.com/opdavies/git-commit-length-counter
|
||||||
|
[2]: https://github.com/opdavies/oliverdavies.uk-drupal/commit/cbd1417b24a608df8b451a3ab5c9f888de41e758
|
Loading…
Reference in a new issue