Use PR to merge two branches into a third branch and resolve conflicts
About 348 wordsAbout 1 minNovember 23, 2024
Create a PR for the first branch:
- Switch to the
first-branch
and ensure it's up-to-date:git checkout first-branch git pull origin first-branch
- Create a PR from
first-branch
tothird-branch
on your remote repository.
- Switch to the
Merge the first PR and resolve conflicts:
- During code review and testing, if conflicts arise, resolve them locally:
git checkout third-branch git pull origin third-branch git checkout -b merge-first-branch git merge first-branch
- Resolve conflicts, then commit the changes:
git add . git commit -m "Resolved merge conflicts between first-branch and third-branch"
- Push the new branch to the remote and update the PR:
git push origin merge-first-branch
- Mark conflicts as resolved in the PR and merge it into
third-branch
.
- During code review and testing, if conflicts arise, resolve them locally:
Create a PR for the second branch:
- Switch to the
second-branch
and ensure it's up-to-date:git checkout second-branch git pull origin second-branch
- Create a PR from
second-branch
tothird-branch
on your remote repository.
- Switch to the
Merge the second PR and resolve conflicts:
- During code review and testing, if conflicts arise, resolve them locally:
git checkout third-branch git pull origin third-branch git checkout -b merge-second-branch git merge second-branch
- Resolve conflicts, then commit the changes:
git add . git commit -m "Resolved merge conflicts between second-branch and third-branch"
- Push the new branch to the remote and update the PR:
git push origin merge-second-branch
- Mark conflicts as resolved in the PR and merge it into
third-branch
.
- During code review and testing, if conflicts arise, resolve them locally: