You basically have two options.
A simple solution: don't team up, rebase
Restore your branch on top of the main branch, resolve the conflict, and then merge. Since you will have a direct history, you can speed up the switch for a merge, and this will not fix the merge.
git checkout feature git rebase main # Resolve conflict if there is git checkout main git merge feature
Second Option: Rebase -i
You can edit your story after the merge ( before that you click on the remote). You can control this using the interactive call forwarding mode.
git checkout main git merge feature
Then you will be taken to an interactive shell with a list of commits, for example:
pick 73c991e Create progress bar module pick b8a0b83 merge branch feature pick 2120f47 Add user form pick 70c55e4 Quiz prototype system
You just need to add squash or s instead of pick :
pick 73c991e Create progress bar module pick b8a0b83 merge branch feature s 2120f47 Add user form pick 70c55e4 Quiz prototype system
This command will be crushed together by b8a0b83 and 2120f47 . The next step is a commit text editor, in which you have a commit message at the same time, and now you need to edit them correctly to save only the original message.
source share