I also do this with optimisations, when I work on low-level code:
If I come up with an inefficient algorithm that's short and readable, I tend to optimise it to something better but leave the reference implementation inside a code block.
(This goes without saying, but: I don't leave "commented code", but code inside comment, generally formatted with Markdown)
GPL has this idea in it: trying to define what exactly should go into that tarball. The question seems meaningful and important even for proprietary code. If some authors assume that anybody modifying their code should be able to look at git commits, that probably simply means that "the preferred form of the work for making modifications to it" is a git repo.
Yes, text is better for convenience and for being future-proof. It's like leaving a description of the bug I'm fixing, instead of just a JIRA ticket identifier.
If I come up with an inefficient algorithm that's short and readable, I tend to optimise it to something better but leave the reference implementation inside a code block.
(This goes without saying, but: I don't leave "commented code", but code inside comment, generally formatted with Markdown)