guradio
guradio

Reputation: 15555

Git conflict on PR when target branch is changed

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:

  1. create new branch from new target branch
  2. squash all commit into one commit
  3. cherry pick the squashed commit into feature branch
  4. force push into remote branch

My question is how can I squash all commits into one commit ?

Upvotes: 0

Views: 38

Answers (1)

VonC
VonC

Reputation: 1327084

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

Upvotes: 2

Related Questions