[GH-ISSUE #13] Wrong commits rewritten #7

Closed
opened 2026-02-27 19:20:53 +03:00 by kerem · 7 comments
Owner

Originally created by @omarzina on GitHub (Nov 14, 2025).
Original GitHub issue: https://github.com/f/git-rewrite-commits/issues/13

First of all, thanks for this tool, helps a lot with side projects where things can get messed up really fast.

So, I was trying it out and it does everything fine, until it applies the changes to the wrong commits.

Here's the output from my terminal:

❯ npx git-rewrite-commits --dry-run --max-commits 2

🚀 Git Commit Message Rewriter with AI

Current branch: feature/dgi-integration

Found 2 commits to process

📝 Generating new commit messages with AI...

✔ [50.0%] 43bdc1e8: ✨ "Limit job concurrency""chore(app/jobs): Update ActiveRecordDoctor configuration"[100.0%] 5822bc59: ✨ "change document serializer to only return CFE tag, not enclosing ENVIOCFE""refactor(document_serializers): update efactura document serializer to only serialize CFE tag"

✅ Saved 2 commit messages

📊 Summary:
  • Total commits analyzed: 2
  • Well-formed commits (skipped): 0
  • Commits improved: 2
  • Commits to be rewritten: 2

🔍 Dry run completed. No changes were made to your repository.
Review the proposed changes above and run without --dry-run to apply them.

~/Developer/gladia/apife feature/dgi-integration ⇣⇡ 7s                                                                                                                                                  16:41:50
❯ npx git-rewrite-commits --max-commits 2

🚀 Git Commit Message Rewriter with AI

Current branch: feature/dgi-integration

Found 2 commits to process

⚠️  WARNING: This will REWRITE your git history!
This is dangerous if you have already pushed to a remote repository.
Make sure to:
  1. Work on a separate branch
  2. Have a backup of your repository
  3. Coordinate with your team if this is a shared repository

Do you want to proceed? (y/n): y

✅ Created backup branch: backup-feature/dgi-integration-1763149323401

📝 Generating new commit messages with AI...

✔ [50.0%] 43bdc1e8: ✨ "Limit job concurrency""chore(app/jobs): Update ActiveRecordDoctor configuration"[100.0%] 5822bc59: ✨ "change document serializer to only return CFE tag, not enclosing ENVIOCFE""refactor(document_serializers): update efactura document serializer to only serialize CFE tag"

✅ Saved 2 commit messages

📊 Summary:
  • Total commits analyzed: 2
  • Well-formed commits (skipped): 0
  • Commits improved: 2
  • Commits to be rewritten: 2

Do you want to apply the new commit messages? (y/n): y

🔄 Rewriting git history...

✅ Successfully rewrote git history!

📌 Important next steps:
  1. Review the changes: git log --oneline
  2. If satisfied, force push: git push --force-with-lease
  3. If something went wrong, restore: git reset --hard backup-feature/dgi-integration-1763149323401
  4. Clean up backup when done: git branch -D backup-feature/dgi-integration-1763149323401
                                                                                                                                                 16:42:45
❯ git log --oneline
0fbb7c9 (HEAD -> feature/dgi-integration) change document serializer to only return CFE tag, not enclosing ENVIOCFE
9139e7d Limit job concurrency
# stayed the same ⬆️
# but if I go to the bottom
0a55830 refactor(document_serializers): update efactura document serializer to only serialize CFE tag
26ca444 chore(app/jobs): Update ActiveRecordDoctor configuration
# those two commits have the proper message for the last two commits, but the message was applied, for some reason, to the first two commits of the branch.

is this a bug?

Thanks again!

Originally created by @omarzina on GitHub (Nov 14, 2025). Original GitHub issue: https://github.com/f/git-rewrite-commits/issues/13 First of all, thanks for this tool, helps a lot with side projects where things can get messed up really fast. So, I was trying it out and it does everything fine, until it applies the changes to the wrong commits. Here's the output from my terminal: ```sh ❯ npx git-rewrite-commits --dry-run --max-commits 2 🚀 Git Commit Message Rewriter with AI Current branch: feature/dgi-integration Found 2 commits to process 📝 Generating new commit messages with AI... ✔ [50.0%] 43bdc1e8: ✨ "Limit job concurrency" → "chore(app/jobs): Update ActiveRecordDoctor configuration" ✔ [100.0%] 5822bc59: ✨ "change document serializer to only return CFE tag, not enclosing ENVIOCFE" → "refactor(document_serializers): update efactura document serializer to only serialize CFE tag" ✅ Saved 2 commit messages 📊 Summary: • Total commits analyzed: 2 • Well-formed commits (skipped): 0 • Commits improved: 2 • Commits to be rewritten: 2 🔍 Dry run completed. No changes were made to your repository. Review the proposed changes above and run without --dry-run to apply them. ~/Developer/gladia/apife feature/dgi-integration ⇣⇡ 7s 16:41:50 ❯ npx git-rewrite-commits --max-commits 2 🚀 Git Commit Message Rewriter with AI Current branch: feature/dgi-integration Found 2 commits to process ⚠️ WARNING: This will REWRITE your git history! This is dangerous if you have already pushed to a remote repository. Make sure to: 1. Work on a separate branch 2. Have a backup of your repository 3. Coordinate with your team if this is a shared repository Do you want to proceed? (y/n): y ✅ Created backup branch: backup-feature/dgi-integration-1763149323401 📝 Generating new commit messages with AI... ✔ [50.0%] 43bdc1e8: ✨ "Limit job concurrency" → "chore(app/jobs): Update ActiveRecordDoctor configuration" ✔ [100.0%] 5822bc59: ✨ "change document serializer to only return CFE tag, not enclosing ENVIOCFE" → "refactor(document_serializers): update efactura document serializer to only serialize CFE tag" ✅ Saved 2 commit messages 📊 Summary: • Total commits analyzed: 2 • Well-formed commits (skipped): 0 • Commits improved: 2 • Commits to be rewritten: 2 Do you want to apply the new commit messages? (y/n): y 🔄 Rewriting git history... ✅ Successfully rewrote git history! 📌 Important next steps: 1. Review the changes: git log --oneline 2. If satisfied, force push: git push --force-with-lease 3. If something went wrong, restore: git reset --hard backup-feature/dgi-integration-1763149323401 4. Clean up backup when done: git branch -D backup-feature/dgi-integration-1763149323401 16:42:45 ❯ git log --oneline 0fbb7c9 (HEAD -> feature/dgi-integration) change document serializer to only return CFE tag, not enclosing ENVIOCFE 9139e7d Limit job concurrency # stayed the same ⬆️ # but if I go to the bottom 0a55830 refactor(document_serializers): update efactura document serializer to only serialize CFE tag 26ca444 chore(app/jobs): Update ActiveRecordDoctor configuration # those two commits have the proper message for the last two commits, but the message was applied, for some reason, to the first two commits of the branch. ``` is this a bug? Thanks again!
kerem closed this issue 2026-02-27 19:20:53 +03:00
Author
Owner

@f commented on GitHub (Nov 15, 2025):

You're running it with --dry-run that's why it doesn't change.

<!-- gh-comment-id:3535119719 --> @f commented on GitHub (Nov 15, 2025): You're running it with `--dry-run` that's why it doesn't change.
Author
Owner

@omarzina commented on GitHub (Nov 15, 2025):

You're running it with --dry-run that's why it doesn't change.

The first time only, the second time I ran it without it. It's there in the logs I posted. It's changing the wrong commits.

# [...]
❯ npx git-rewrite-commits --max-commits 2

🚀 Git Commit Message Rewriter with AI

Current branch: feature/dgi-integration

Found 2 commits to process

⚠️  WARNING: This will REWRITE your git history!
This is dangerous if you have already pushed to a remote repository.
Make sure to:
  1. Work on a separate branch
  2. Have a backup of your repository
  3. Coordinate with your team if this is a shared repository

Do you want to proceed? (y/n): y

✅ Created backup branch: backup-feature/dgi-integration-1763149323401

📝 Generating new commit messages with AI...

✔ [50.0%] 43bdc1e8: ✨ "Limit job concurrency""chore(app/jobs): Update ActiveRecordDoctor configuration"[100.0%] 5822bc59: ✨ "change document serializer to only return CFE tag, not enclosing ENVIOCFE""refactor(document_serializers): update efactura document serializer to only serialize CFE tag"

✅ Saved 2 commit messages

📊 Summary:
  • Total commits analyzed: 2
  • Well-formed commits (skipped): 0
  • Commits improved: 2
  • Commits to be rewritten: 2

Do you want to apply the new commit messages? (y/n): y

🔄 Rewriting git history...

✅ Successfully rewrote git history!

📌 Important next steps:
  1. Review the changes: git log --oneline
  2. If satisfied, force push: git push --force-with-lease
  3. If something went wrong, restore: git reset --hard backup-feature/dgi-integration-1763149323401
  4. Clean up backup when done: git branch -D backup-feature/dgi-integration-1763149323401
                                                                                                                                                 16:42:45
❯ git log --oneline
0fbb7c9 (HEAD -> feature/dgi-integration) change document serializer to only return CFE tag, not enclosing ENVIOCFE
9139e7d Limit job concurrency
# stayed the same ⬆️
# but if I go to the bottom
0a55830 refactor(document_serializers): update efactura document serializer to only serialize CFE tag
26ca444 chore(app/jobs): Update ActiveRecordDoctor configuration
# those two commits have the proper message for the last two commits, but the message was applied, for some reason, to the first two commits of the branch
<!-- gh-comment-id:3535124858 --> @omarzina commented on GitHub (Nov 15, 2025): > You're running it with `--dry-run` that's why it doesn't change. The first time only, the second time I ran it without it. It's there in the logs I posted. It's changing the wrong commits. ```sh # [...] ❯ npx git-rewrite-commits --max-commits 2 🚀 Git Commit Message Rewriter with AI Current branch: feature/dgi-integration Found 2 commits to process ⚠️ WARNING: This will REWRITE your git history! This is dangerous if you have already pushed to a remote repository. Make sure to: 1. Work on a separate branch 2. Have a backup of your repository 3. Coordinate with your team if this is a shared repository Do you want to proceed? (y/n): y ✅ Created backup branch: backup-feature/dgi-integration-1763149323401 📝 Generating new commit messages with AI... ✔ [50.0%] 43bdc1e8: ✨ "Limit job concurrency" → "chore(app/jobs): Update ActiveRecordDoctor configuration" ✔ [100.0%] 5822bc59: ✨ "change document serializer to only return CFE tag, not enclosing ENVIOCFE" → "refactor(document_serializers): update efactura document serializer to only serialize CFE tag" ✅ Saved 2 commit messages 📊 Summary: • Total commits analyzed: 2 • Well-formed commits (skipped): 0 • Commits improved: 2 • Commits to be rewritten: 2 Do you want to apply the new commit messages? (y/n): y 🔄 Rewriting git history... ✅ Successfully rewrote git history! 📌 Important next steps: 1. Review the changes: git log --oneline 2. If satisfied, force push: git push --force-with-lease 3. If something went wrong, restore: git reset --hard backup-feature/dgi-integration-1763149323401 4. Clean up backup when done: git branch -D backup-feature/dgi-integration-1763149323401 16:42:45 ❯ git log --oneline 0fbb7c9 (HEAD -> feature/dgi-integration) change document serializer to only return CFE tag, not enclosing ENVIOCFE 9139e7d Limit job concurrency # stayed the same ⬆️ # but if I go to the bottom 0a55830 refactor(document_serializers): update efactura document serializer to only serialize CFE tag 26ca444 chore(app/jobs): Update ActiveRecordDoctor configuration # those two commits have the proper message for the last two commits, but the message was applied, for some reason, to the first two commits of the branch ```
Author
Owner

@f commented on GitHub (Nov 15, 2025):

Can you retry with the new version I've just released?

<!-- gh-comment-id:3535386329 --> @f commented on GitHub (Nov 15, 2025): Can you retry with the new version I've just released?
Author
Owner

@sebastienbarre commented on GitHub (Nov 16, 2025):

This is very real and will very much mess up your repo. I wrote about it in more details here, the wrong commits are being modified.

<!-- gh-comment-id:3538091508 --> @sebastienbarre commented on GitHub (Nov 16, 2025): This is very real and will very much mess up your repo. I wrote about it in [more details here](https://github.com/f/git-rewrite-commits/issues/2#issuecomment-3536134039), the wrong commits are being modified.
Author
Owner

@f commented on GitHub (Nov 16, 2025):

YOU ARE RIGHT! I was calculating the commits wrong if you're using --max-commits. Now it's fixed with latest 0.6.92 version! (I've tested it!)

Thank you!

<!-- gh-comment-id:3538415216 --> @f commented on GitHub (Nov 16, 2025): YOU ARE RIGHT! I was calculating the commits wrong if you're using --max-commits. Now it's fixed with latest 0.6.92 version! (I've tested it!) Thank you!
Author
Owner

@f commented on GitHub (Nov 16, 2025):

Can you test and close if it worked?

<!-- gh-comment-id:3538415645 --> @f commented on GitHub (Nov 16, 2025): Can you test and close if it worked?
Author
Owner

@omarzina commented on GitHub (Nov 17, 2025):

Just were able to try it on version 0.7.3 and it's still happening, exactly the way described above.

❯ git-rewrite-commits --version
0.7.3
<!-- gh-comment-id:3541888081 --> @omarzina commented on GitHub (Nov 17, 2025): Just were able to try it on version `0.7.3` and it's still happening, exactly the way described above. ```sh ❯ git-rewrite-commits --version 0.7.3 ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-rewrite-commits#7
No description provided.