1

I have multiple commits done on a branch for a C project and would like to squash them into just two commits.

Commit 1 - should have only the changes to the actual functionality source code

Commit 2 - should have the changes to the test code only

The problem is, the commits are not in squence for the functionaly code and test code , for example below, when git rebase -i <hash> is run :

pick 626e9699 src : first src commit 
pick 07535353 src : second src comit
pick 9c768710 test: first test commit
pick 985f9f33 src : third src commit
pick fef22111 test: second test commit
pick 3e4e5991 src : fourth src commit

I have squashed commits when they are in the right order before without issues, but wondering how this would work. Thanks in advance

Engineer999
  • 3,683
  • 6
  • 33
  • 71
  • 2
    You can edit the _order_ of commits by changing that list, as well as the pick/squash/edit/etc. options. – jonrsharpe Aug 25 '22 at 08:38
  • 2
    You might want to reorder your commits first, with `git rebase` & `pick`, then squash. I guess the "reorder" might have been the step you were missing. – Larme Aug 25 '22 at 08:38
  • @jonrsharpe By moving the order of the commits in the text file will reorder them? – Engineer999 Aug 25 '22 at 08:43

0 Answers0