I currently have a branch which looks like the following (with A being the most recent commit and K being the oldest, many months ago)
A-B-C-D-E-F-G-H-J-K (branch-alpha)
What I would like to do is replace commits D-G with Z so that the resulting branch looks like so
A-B-C-Z-H-J-K (branch-alpha)
All the examples I could find refer to combining the most recent commits, but I want to keep the most recent 3 commits are they are. I want to combine commits number 4, 5, 6, 7, all into one. How can I achieve this?