0

Hi I am in difficulty with this scenarios: I have two local branch: develop and branch1. On remote I have develop branch only.

The steps that i followed:

  • I have pulled remote develop from my local develop.
  • I have created new branch branch1 and add some code inside it.

I need to create, and push all the modification of branch1 on remote. After doing it I am costrained to go to github and make a pull request from my "branch1" remote branch to the develop remote branch.

Which are the steps that I need to do in case of conflicts? I try to read a lot but the major part are merging in local and push on develop ( or master ) but my scenario is different cause i need to push on remote branch1 and from there to ask to review the code from a person and make a pull request. I need to avoid conflicts.

1 Answer 1

1

If I understand your question:

  • You are following a standard pull request workflow that merges feature branches ("branch1") into a long-lived "develop" branch.
  • Sometimes, as a result of the peer review process, you end up with merge conflicts. You want to avoid this.

Solution:

Avoiding merge conflicts:

There is no way to "avoid" merge conflicts in a workflow such as this one (or in any workflow, really). The best you can do is to remind the peer reviewer that time-consuming merge conflicts are likely to occur unless they are reviewed and merged quickly.

Resolving merge conflicts:

Most of the time, resolving the merge conflicts in this workflow is easy:

  • In your local copy, checkout develop:
git pull origin develop
  • Rebase "branch1" against develop:
git checkout branch1
git rebase develop
  • Interactively resolve the merge conflicts.

You really do need to know how to resolve merge conflicts, e.g. ref.

  • Push branch1:
git push origin branch1 --force

(Force is required because the rebase operation rewrites the history.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.