I tried to create a new pull request after pushing to my branch, as I want to merge my branch into the main branch. GitHub's response was "This branch has conflicts that need to be resolved". However, the conflicts are so complex that I should resolve them locally. The suggestion for this was:
Step 1: Clone the repository or update your local repository with the latest changes.
git pull origin main
Step 2: Switch to the head branch of the pull request.
git checkout myBrach
Step 3: Merge the base branch into the head branch.
git merge main
Step 4: Fix the conflicts and commit the result.
See Resolving a merge conflict using the command line for step-by-step instructions on resolving merge conflicts.
Step 5: Push the changes.
git push -u origin myBranch
But after git merge main
I get the following error:
error: Your local changes to the following files would be overwritten by merge:
... // Files listed
Merge with strategy ort failed.
I thought this suggestion will help me to update myBranch and remove the "commits behind main". I don't know what this error Merge with strategy ort failed
means and how I can solve this problem without losing code.