So say I have commits my dev
branch,
a
b
c
I do a pull/merge request to the main
branch, with squash merge option turned on.
So the main
branch now looks like,
merge from 'dev' to 'main'
squash: a, b, c
But my source branch dev
remains to be three seperated commits. And that could be a problem when I do git rebase main
on dev
branch, especially when the main
branch is stuffed with other developers' squashed merges.
Normally, I would cherry-pick
my ahead commits onto a dev_bak
branch. delete my current branch dev
and republishes it by doing
git switch [any-branch]
git branch -d dev // delete dev branch
git checkout -b dev // re-create dev branch
git rebase main // do rebase
git push --force // force push to remote to overwrite
And cherry-picks my ahead commits back onto the dev
branch.
So I was wondering if there is a quick way of doing this? Perhaps git rebase --force
?
Thanks!!