If you created the branch from main but you now need to rebase onto main then main must have been updated since you created your branch. The conflicts come from those changes.
I understand that this can be resolved by:
git checkout main git rebase feature/x (resolve conflicts)
This isn’t correct. This would rebase main onto feature/x; you need to rebase feature/x onto main.
Instead,
- update your local
mainfrom GitHub before the rebase bypulling it or similar, - check
feature/xout, - run
git rebase main, and - resolve conflicts.
Then push your feature branch to GitHub (you’ll need to use --force-with-lease since this rewrites commit hashes). The pull request will be updated accordingly.