<p>The other day, <a href="/daily/2024/05/21/which-commit-has-the-largest-message">I posted about a script I'd written</a> that found the longest commit message in a repository.</p>
<p>As I couldn't find a native way to do this with Git, the script loops over each commit in the repository, calculates its length and stores the length and commit SHA in a file.</p>
<p>The lines in the file are sorted so the longest commit is first.</p>
<p>Whilst I commonly use short parameters, such as <code>git add -p</code> when typing commands, in scripts, I prefer to use the equivalent longer parameters, where possible.</p>
<p>For example, in the script, I execute this command to sort the lines:</p>
<p>Whilst the original is more verbose and longer to type, I prefer its verbosity which makes it easier for me or others to read and understand in the future.</p>
<p>The other day, <a href="/daily/2024/05/21/which-commit-has-the-largest-message">I posted about a script I'd written</a> that found the longest commit message in a repository.</p>
<p>As I couldn't find a native way to do this with Git, the script loops over each commit in the repository, calculates its length and stores the length and commit SHA in a file.</p>
<p>The lines in the file are sorted so the longest commit is first.</p>
<p>Whilst I commonly use short parameters, such as <code>git add -p</code> when typing commands, in scripts, I prefer to use the equivalent longer parameters, where possible.</p>
<p>For example, in the script, I execute this command to sort the lines:</p>
<p>Whilst the original is more verbose and longer to type, I prefer its verbosity which makes it easier for me or others to read and understand in the future.</p>