Hacker News new | ask | show | jobs
by rob74 823 days ago
> I am curious if there’s been any work on _semantic_ diff tools as well (for when eg the syntax changes but the meaning is the same)

So when using such a diff tool you can spend hours refactoring something, and then git will refuse to commit your changes because your refactoring was successful in not changing the behavior of the code? I understand what you mean, but if we arrive at that point maybe we should stop calling it "diff", to avoid confusion...

1 comments

Git doesn't use the output of `diff` to determine whether anything has changed.
True, although not widely known it would seem.

It does use diff to generate patches, however. I know in today's GitHub-dominated landscape, that's considered a bit of a dusty feature, but it would be a pity to break it.

If you want to generate patches rather than look at local differences, there's a specific command for that - https://git-scm.com/docs/git-format-patch