Skip to content
Mrozowski Digital

NotesBuilding with AI3 min read

Why Every AI-Built App Needs Git Commits

Git commits give you a clear history of what your AI changed - and a reliable way to undo it.

Piotr MrozowskiFounder, Mrozowski International

AI is very good at changing code. Unfortunately (as we all find out sooner or later, rather painfully), it is not always as good at changing only what you asked it to change.

Let’s say you request a new contact form. The form works, but something else stops working. You ask AI to fix that problem, it rewrites another part of the application, and three prompts later neither you nor the AI is completely sure where things went wrong.

This is where Git commits become incredibly useful.

What is a Git commit?

A Git commit is essentially a named save point for your project.

It records exactly what changed at a particular moment, allowing you - or your AI - to inspect those changes later. If something goes wrong, you can return to an earlier version instead of asking AI to reconstruct what used to work.

Think of it as a much more powerful Ctrl+Z: one that still works tomorrow, after fifty more changes, or even after switching to another AI tool.

You do not need to understand Git commands to benefit from this. Your AI coding tool can handle them for you. You just need to tell it how you want the work organized.

Why commits help the AI too

Commits are not only useful for humans.

When your project has a clean commit history, AI can inspect it to understand:

  • what was changed
  • when it was changed
  • which files were involved
  • what the application looked like before the change

If a particular change introduced a problem, the AI can compare it with the previous version or revert that specific commit.

Without commits, fixing a mistake often means asking AI to rewrite the code again and (wishfully) hoping it correctly recreates the previous behavior. That can easily introduce even more unintended changes.

Small commits are better than one giant commit

Simply telling AI to “commit everything when finished” is better than having no history, but it is still not ideal.

Imagine asking it to:

  1. Add a contact form.
  2. Connect it to your email service.
  3. Add loading and error states.
  4. Change the design of the page.

If all of that appears in one large commit, reverting it removes everything - even if only the design change caused a problem.

Instead, each logical piece of work should have its own commit:

  • Add contact form fields and validation
  • Connect contact form to email service
  • Add loading and error states
  • Update contact page styling

Now every change can be inspected, tested, or reversed independently.

A prompt you can reuse

Before asking AI to implement a feature, add this to your instructions:

Before making any changes, check the current Git status and make sure
the existing work is preserved. Do not delete or overwrite uncommitted
changes.

Break the requested work into small, logical steps. After completing
each step, run the relevant checks and create a separate Git commit
with a clear, descriptive message.

Do not combine unrelated changes in the same commit. If a step
introduces a problem, revert that step instead of rewriting unrelated
parts of the project.

You can also include this as a permanent instruction in your project so you do not need to repeat it in every conversation.

Commits are not backups

One important distinction: commits create version history, but that history may still exist only on your computer.

To protect the project if your computer is lost or damaged, the commits should also be pushed to a remote service such as GitHub (preferably), GitLab, Bitbucket or similar. If your AI-building platform supports connecting the project to GitHub, use it.

The combination is what you want:

  • Git commits provide organized save points.
  • A remote repository keeps a separate copy of them.

Keep in mind

Before letting AI make significant changes to your application, make sure the current version is committed.

Then ask it to divide the work into small commits as it progresses.

AI will still occasionally make mistakes. The difference is that those mistakes become easy to identify and reverse - instead of becoming another problem for AI to solve.