Hacker News new | ask | show | jobs
by rhencke 2904 days ago
If you do wish to use commits to simply journal your thoughts, and would like to do so without this requiring code or file changes, you may find the --allow-empty option useful when committing.

This allows you to create a new commit, even if no files have changed.

2 comments

Or, write your journal entries to a file and commit that? That's what I do. Most of my personal projects have a "notes.txt" at the top level for this purpose. Sometimes I just need to write freeform about the problem I'm trying to solve, from different angles, to work out my strategy. Sometimes I just write the despair that I'll never figure something out.
How would one enable this in Visual Studio?
Unfortunately, as far as I am aware, Visual Studio does not directly expose this option.

However, it is quite likely you can use Visual Studio's "External Tools" feature to be able to achieve this. (https://msdn.microsoft.com/en-us/library/76712d27.aspx)

You could set up an external tool that did something like the following:

Title: Commit with Selected Text as Message

Command: path\to\git.exe

Initial Directory: $(SolutionDir)

Arguments: commit --allow-empty -m "$(CurText)"

This will allow you to create an empty commit, with the selected text becoming the commit message. (Just bear in mind if you have any files staged, they will be committed as well)

I unfortunately do not have Visual Studio currently installed, so please take the above as a rough sketch, and my apologies if it doesn't work as is. But, I hope it is of use to you.