0

I have a bunch of commits:

T-1: commit-50
...
T-1: commit-1

Now I need to merge them under a new task. Is there a way to automatize turning them into

T-2: commit-50
...
T-2: commit-1

?

Yola
  • 18,496
  • 11
  • 65
  • 106
  • 1
    Is there an actual merge involved here, or do you just want to edit the commit messages of the 50 commits (or more precisely, replace the commits with new commits with altered commit messages)? – chepner Jul 26 '21 at 23:07
  • 1
    @chepner In my case, those are the latest commits and I'm OK with rewriting them with new commits with altered commit messages. – Yola Jul 26 '21 at 23:18
  • Does this answer your question? [What's the fastest way to edit hundreds of Git commit messages?](https://stackoverflow.com/questions/14332551/whats-the-fastest-way-to-edit-hundreds-of-git-commit-messages) (Note I'd probably start by trying git-filter-repo over filter-branch.) – TTT Jul 27 '21 at 05:20

1 Answers1

0

Suppose T1's commit-1 is A and commit-50 is Z.

Generate patches from A to Z.

git format-patch A^..Z

Apply the patches on the new task's branch.

git am /path/to/*.patch

There could be conflicts. If any, resolve the conflicts and apply the rest.

ElpieKay
  • 27,194
  • 6
  • 32
  • 53