I wanted to create a PR on a new target branch but Im getting an conflict because the old feature branch is created using old target branch and creating a PR to new branch will create an error.
so I am doing these steps:
- create new branch from new target branch
- squash all commit into one commit
- cherry pick the squashed commit into feature branch
- force push into remote branch
My question is how can I squash all commits into one commit ?
CodePudding user response:
my question is if i have two commits how can i squash them into one commit so that I can use cherry-pick to that commit ?
As mentioned in "How do I squash my last N commits together?", with a combination of reset --soft
commit
:
git switch oldTargetBranch
git reset ‒soft commitBeforeYourTwocommits
git commit -am "squash old branch"
git switch newTargetBranch
git cherry-pick oldTargetBranch