From f15ea5343fc64902624054df947d6bdc6949034f Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 24 May 2024 00:49:35 +0100 Subject: [PATCH] Add daily email for 2024-05-21 Which commit has the largest message? --- source/_daily_emails/2024-05-21.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 source/_daily_emails/2024-05-21.md diff --git a/source/_daily_emails/2024-05-21.md b/source/_daily_emails/2024-05-21.md new file mode 100644 index 00000000..8557dd56 --- /dev/null +++ b/source/_daily_emails/2024-05-21.md @@ -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