Hugo, or any other static site generator that could benefit from Git, could become a life saver for those who suffer from OCD.

It is usually recommended squashing development commits to maintain a clean commit history. That’s indeed true for coding related stuff.

However, for content updates such as blog posts, squashing commits doesn’t make too much sense - most changes are trivial and random, hence it’s not quite easy to even group them into a meaningful bundle (as opposed to typical development work that could be committed modularly).

Trying to construct a “clean” commit in this case could drive one crazy.

Fortunately, I came up with the following “clean” approach, at commit message level (scroll down to see all):

Git Commits

Now check it out:

$ git log --pretty=format:"%s" > logs.txt
>>> f = open('logs.txt')
>>> logs = f.read().split('\n')
>>> f.close()
>>> logs
['z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a', '0', '9', '8', '7', '6', '5', '4', '3', '2', '1', 'Z', 'Y', 'X', 'W', 'V', 'U', 'T', 'S', 'R', 'Q', 'P', 'O', 'N', 'M', 'L', 'K', 'J', 'I', 'H', 'G', 'F', 'E', 'D', 'C', 'B', 'A', 'z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a', '?', '>', '<', '"', ':', '|', '}', '{', '/', '.', ',', "'", ';', '\\', ']', '[', '=', '-', '`', '+', '_', ')', '(', '*', '&', '^', '%', '$', '#', '@', '!', '~', '0', '9', '8', '7', '6', '5', '4', '3', '2', '1', 'Z', 'Y', 'X', 'W', 'V', 'U', 'T', 'S', 'R', 'Q', 'P', 'O', 'N', 'M', 'L', 'K', 'J', 'I', 'H', 'G', 'F', 'E', 'D', 'C', 'B', 'A', 'z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a', 'Initial commit']

>>> from collections import Counter
>>> counts = Counter(logs)
>>> counts
Counter({'z': 3, 'y': 3, 'x': 3, 'w': 3, 'v': 3, 'u': 3, 't': 3, 's': 3, 'r': 3, 'q': 3, 'p': 3, 'o': 3, 'n': 3, 'm': 3, 'l': 3, 'k': 3, 'j': 3, 'i': 3, 'h': 3, 'g': 3, 'f': 3, 'e': 3, 'd': 3, 'c': 3, 'b': 3, 'a': 3, '0': 2, '9': 2, '8': 2, '7': 2, '6': 2, '5': 2, '4': 2, '3': 2, '2': 2, '1': 2, 'Z': 2, 'Y': 2, 'X': 2, 'W': 2, 'V': 2, 'U': 2, 'T': 2, 'S': 2, 'R': 2, 'Q': 2, 'P': 2, 'O': 2, 'N': 2, 'M': 2, 'L': 2, 'K': 2, 'J': 2, 'I': 2, 'H': 2, 'G': 2, 'F': 2, 'E': 2, 'D': 2, 'C': 2, 'B': 2, 'A': 2, '?': 1, '>': 1, '<': 1, '"': 1, ':': 1, '|': 1, '}': 1, '{': 1, '/': 1, '.': 1, ',': 1, "'": 1, ';': 1, '\\': 1, ']': 1, '[': 1, '=': 1, '-': 1, '`': 1, '+': 1, '_': 1, ')': 1, '(': 1, '*': 1, '&': 1, '^': 1, '%': 1, '$': 1, '#': 1, '@': 1, '!': 1, '~': 1, 'Initial commit': 1})

>>> len(logs) - len(counts)
88

>>> import string
>>> len(string.ascii_lowercase) * 2 + len(string.ascii_uppercase) + len(string.digits)
88

Everything just matches up.

Isn’t it beautiful?! 🙃