Home > Back-end >  After git merge, abort conflicts not showing
After git merge, abort conflicts not showing

Time:10-03

I have an issue about git pull conflicts. I have a feature and a develop branches.

  1. First, I pulled develop branch from BitBucket, there were conflicts in some files. But I did not resolved conflicts and aborted merge.
  2. Then, I pushed my feature branch to BitBucket, and I created pull request.
  3. The pull request rejected because of conflicts.
  4. After pr rejected, I changed my branch to develop and pulled develop branch from BitBucket again.
  5. But there are not conflicts anymore. In the feature and the develop branches, "All files up to date" message is shown now. What can I do solving the conflicts or approval my pr now?

CodePudding user response:

The conflicts seems to be between your develop and your main (or master branch.)

When you type git pull, you're actually pulling the matching branch, so you won't see the conflict.

For this, you need to pull the branch you target with your PR. Assuming this is main on your origin remote, you'll need to type git pull origin main.

CodePudding user response:

A conflict is always between two branches: it happens when you are trying to combine two different people's changes, and they have both changed the same piece of code.

In step 1, you describe trying to combine the latest changes from "develop" with the changes on your "feature" branch. You saw conflicts, and aborted the merge. A "pull" is just a fetch of some remote changes, followed by merging those changes into the current branch.

In step 2, you tried to do the same merge the other way around: you raised a PR to merge "feature" into "develop", so you saw exactly the same conflicts. No surprise there, you're still trying to combine the same changes.

In step 4, you did something completely different: you switched to your local copy of "develop", and pulled in the changes from the remote "develop". Your local "develop" didn't have any of its own changes, so there were no conflicts, and git simply "fast-forwarded" the branch to point to the same commit. That will have had no effect whatever on your local feature branch.

You still need to combine the changes from "feature" and "develop". Check out "feature" and merge "develop" into it. Unless "develop" has changed since you last tried, you will get the same conflicts as at step 1. You have to resolve them, there is no magic wand which will let you avoid it. Then push the result up to BitBucket, and the pull request will no longer be blocked, because all the changes from "develop" will be incorporated into "feature", and no longer conflict.

  • Related