News for hackers. Stuff that matters.
Re:Git Commands You Probably Do Not Need by rwmj on Monday January 23, 2023 @08:15AM (#34488352)
Empty commits are important! They help when you want to write your thoughts down in a commit message before making the actual code change.
Re:Git Commands You Probably Do Not Need by u801e on Monday January 23, 2023 @08:36AM (#34488551)
I make empty commits when I want to update the commit message without changing anything in the referenced tree. I do this by prefixing the title of the commit I message I want to update with squash!. Then, when run an interactive rebase with the --keep-empty flag, git will open my editor and I can just delete the original commit message and leave the new commit message I made with the squash! prefixed commit and then continue with the rebase.

This allows me to essentially show how I would change a commit message without having to run rebase or amend a commit in a code review, which hides the original commit.

Re:Git Commands You Probably Do Not Need by myme on Monday January 23, 2023 @10:52AM (#34490282)
Ah, what a stellar use case. It's been forever since I looked into git notes (or was it annotations? can't check right now). But I guess those had significant flaws. Empty commits that you can use the message as a todo-list and fixup/amend in changes as you go. Might try this.
Re:Git Commands You Probably Do Not Need by ekimekim on Monday January 23, 2023 @11:40AM (#34491138)
I occasionally use empty commits to leave notes to myself that I want to be shown when I go to clean up my history (generally with rebase -i) and get it ready for review. It works well as rebase -i will default to commenting out empty commits, thus drawing attention to them.