Blogging Through Git Commits

Ever since my friend Tom got me started using git I have been very intentional about practicing the art of crafting good commits. It is central to my understanding of how git works and how it ought to be used in community with others.

Since github, I've been basically sending people messages in the commit messages, and it has been a helpful realization. A commit message is a succinct communication to someone else.

The commit exists because you faced a problem, solved it, and encapsulated it as code and commit message. No reason to restate in future texts or emails, you can refer back to the commit. It's a message.

Here's a recent example that I sent to my friends. We all are tinkering with syncing our dotfiles and configuration over git, and I knew that three to five of them would need this trick immediately. Adding the reference means that they will have to ask me less questions about the reasoning where I found this.

I've been thinking… could I create an alias for git's internal formatter to output a commit as a markdown blog post?

I am currently experimenting with git --no-pager show --format="# %B ```diff"; echo '```'. It's pretty close, but I'm pretty sure with some sed or awk magic, I could make it even better. Here's what it renders from that git commit above:

Stow ignores .gitignore / .cvsignore by default

By specifying a local file that doesn't ignore .cvsignore, I finally got this to work. * headdesk *

diff --git a/git/.stow-local-ignore b/git/.stow-local-ignore
new file mode 100644
index 0000000..323b5f3
--- /dev/null
+++ b/git/.stow-local-ignore
@@ -0,0 +1,25 @@
+# ~./dotfiles/.stow.local.ignore: Files to be ignored by gnu 'stow'
+# Comments and blank lines are allowed.
+# See 'info stow' section "4 Ignore Lists" for more information
+\.\#.+       # CVS conflict files / emacs lock files
+.+~          # emacs backup files
+\#.*\#       # emacs autosave files

It's a start. Anyone want to take this further?

  • 2022-06-08 11:31:29 -0500
    Rename articles

  • 2022-04-25 14:35:11 -0500
    Blogging through git commits