0

I have a feature branch that I've been doing work on and committing at save points along the way. During this process, I had to merge the develop branch into my feature branch to pick up some bug fixes that another developer did. So my commit history looks something like this:

  • In progress #4
  • In progress #3
  • Merge develop into feature branch
  • In progress #2
  • In progress #1
  • etc...

I want to squash all of the "In progress" commits but leave the merge commit in place. How can I do that using either command line or TortoiseGit?

Yue Lin Ho
  • 2,945
  • 26
  • 36
Scott
  • 13,735
  • 20
  • 94
  • 152
  • Possibly a duplicate of http://stackoverflow.com/questions/15915430/what-exactly-does-gits-rebase-preserve-merges-do-and-why – Thibault D. Mar 01 '16 at 15:15
  • when I do rebase i use interactive mode, i.e. `git rebase -i HEAD~6` so in first prompt I will take out the `Merge develop into feature branch` thats how I will do it – Ciasto piekarz Mar 01 '16 at 15:17
  • Does this answer your question? [How do I squash two non-consecutive commits?](https://stackoverflow.com/questions/3921708/how-do-i-squash-two-non-consecutive-commits) – Dunc May 13 '21 at 14:09
  • I think I got the question answered 5 years ago. ;) Thank you though. – Scott May 14 '21 at 15:26

1 Answers1

1

As mentiones in the comment, you can do a git rebase with preserve merges option. And then reorder the commits and squash them

TheGeorgeous
  • 3,927
  • 2
  • 20
  • 33