sidnt / proden

prog ram de sign n otes
0 stars 0 forks source link

code reformatting #32

Open sidnt opened 8 months ago

sidnt commented 8 months ago

let's say we run pnpm format on a clean working tree. we get some changes and we commit them, in one neat commit, with message reformatting code so that we know this change was introduced when we reformatted the codebase.

however, when viewing git blame for lines edited this way, we see the commit message reformatting code. while, we might want to understand why this line was written. so we inevitably open file history and see the last commit message for that line.

if the message is just around linting, we lose git blame upfront regarding why that line was introduced, as described by a previous meaningful commit message.

what can we do in this situation? simple. we can just copy the message over from the last commit using

git commit --reuse-message=HEAD

sidnt commented 8 months ago

well. not so simple. because different files touched by reformatting, might as well have different commit messages. and again, we are clobbering their own meaningful message history by picking up the last commit message.

what can we do in this situation?