The need for a smart diff apply tool

Have you ever had to make a change to a project that was very similar to a previous change? For example, adding another field to a table in a database or adding another parameter to a function? If so, you know that it can be time-consuming to make these changes, especially if you have to make them manually each time.

Luckily, there is a solution to this problem: using GPT (Generative Pre-trained Transformer) to generate a new changeset based on a previous one.

Here’s how it works:

  1. Get the changeset of the previous change: When you made the previous change, you should have created a Git commit with a changeset that describes what you did. You can use Git to retrieve this changeset.

  2. Use GPT to generate a new changeset based on the previous one: GPT is a deep learning model that can generate text based on an input prompt. In this case, you can use the previous changeset as the input prompt for GPT and ask it to generate a new changeset that adds the new field or parameter. GPT will generate a new changeset that is similar to the previous one but with the new field or parameter added.

  3. Apply the new changeset to the Git repo: Once you have the new changeset, you can apply it to the Git repo using Git. This will automatically make the necessary changes to your project without you having to do it manually.

While this process promises to automate programming tasks, there is still a bottleneck in the validity of the changeset generated in step 2. Although the generated changeset might work for humans, it may not always be strictly valid. This can cause issues in the codebase and lead to bugs.

If a smart diff apply tool exists, we can greatly accelerate our development workflows and reduce the risk of errors caused by automated tooling. It’s an investment that can pay off many times over in increased efficiency and higher quality codebases.