So this is probably a silly idea, and there are probably workarounds/other solutions to this. I am curious about these, but also curious about the specific answer to the following question.
Is it possible to create a diff for a commit that simply removes and adds the same exact code thereby giving you an opportunity to create a commit that is really just metadata to specific lines of code, i.e. way to create a comment that is ephemerally attached to the lines of code until those lines are changed?
Reason: My git reflexes make me want to ensure that every commit is fully working code, that way you don't have to guess how many commits you need to pop off if you need to roll something back. However this essentially gives you a single commit message to apply to all lines of code changed in that commit. (Maybe this is my fundamental problem?)
If there was a way to create a non-diff, that I could create a commit on, I could simply add a "comment" (commit message) to a few lines of code, embedded in which would be the author of the "comment", and a date-stamp of when the "comment" was made.
Then I could just get rid of all hard comments (i.e. lines starting with // or # or whatever) in my code, and look at a blame if I want to look for comments. And if I ever change something I either have to intentionally perpetuate the comment, write a new one, or just leave it up to whatever functional change I made. In this way you would never have a TODO that doesn't need to be done, and you would never have a NOTE that doesn't apply anymore once you've changed the code.
Is it possible to create a diff for a commit that simply removes and adds the same exact code thereby giving you an opportunity to create a commit that is really just metadata to specific lines of code, i.e. way to create a comment that is ephemerally attached to the lines of code until those lines are changed?
Simply, No. Your example of a comment would be a code change and thus it would show up in the diff.
Some potential options: