When I work in a team and must push my local branch to the remote main, I rebase firstly my local branch to master with this simple command:
git fetch && git rebase origin/main
But when I do that, all my local commits are applied and conflicts occur because the code of these previous commits are different to my last local state (saved in my last commit). And solving conflicts of my own commits takes a lot of (useless) time...
I’m afraid to do a mishandle, so I search for some help here. My question:
How can I merge all my local commit into one before a rebase ? And thanks that, when I rebase, there is just one commit to apply
I don't know if its the better approach, feel free to give my advise. :) Thank you!