Clean Git history (atomic commits) is the "Industry Standard" we all aim for. But let's be honest: in the heat of a sprint, nobody has time for it.

To fix a typo in a commit from 3 hours ago, a developer usually has to perform "Git Surgery."

  1. Find the hash.
  2. Create a fixup commit.
  3. Run an interactive rebase.
  4. Manage the todo list in Vim/Notepad.
  5. Pray you didn't break the build.

It’s too much friction. So, I decided to fix it. I built a custom alias called amend-to.

💎 The Hook: Turning 7 Steps into 1

I wanted to make the right way the easiest way. Here is the ROI of the tool I built:

The "Vanilla" Git Struggle 😫 The git-sutra Way 🧘
1. Run git log to find the hash. 1. git amend-to <hash>
2. git commit --fixup <hash> (Creates mess). DONE.
3. git rebase -i --autosquash <hash>~1.
4. Wait for text editor to open.
5. Verify the todo list manually.
6. Save and Close editor.
7. Hope you didn't pick the wrong parent.

It worked perfectly. I felt like a wizard. 🧙‍♂️

Then, I made the rookie mistake. I ran git pull.


💥 The Crash: A Tale of Two Timelines

Boom. 💥

Suddenly, my clean history of 51 commits exploded into 72 commits. My terminal screamed with errors on files I knew I had just written.

I looked at the logs, and I saw this nightmare:

text

Auto-merging gitinit.cmd
CONFLICT (add/add):Merge conflictin gitinit.cmd