0

I have a master and a branch A.

I'm trying to get changes to go from A to master.

However, there are merge conflicts.

Currently, when I use git merge or similar things (for example, IntelliJ's built-in merge conflict resolver or SourceTree + KDiff3), when there are conflicts, I can fix them.

However, the fixes I make are done on the master branch.

This means with a protected remote master (i.e. via GitHub) where you can't push directly to master, I can't actually commit the merge conflict fixes.

Is there a way to make edits committed to A and then merge them altogether into master?

I can get this behavior using GitHub's merge conflict editor - when you use it, it commits the changes into branch A and then you still have to do code review, etc. to commit into master. But I would like to be able to do the merge conflict resolution in my IDE, ideally.

Edit: further searching has suggested that I can actually merge master into A, resolving conflicts in the process, and then merge A back into master. Can anyone confirm if that sounds right?

3
  • If your fixes are made on master branch then your current HEAD is master. I guess you have to checkout to branch A first and then make the conflict changes. Commented Feb 20, 2020 at 0:30
  • 1
    your latest comment sounds right: 1) git checkout A && git merge master (this merges master into A); 2) resolve conflicts; 3) git add <what needs to be committed> && git commit; 4) git checkout master && git merge A; Hope it helps Commented Feb 20, 2020 at 0:31
  • Thanks, just tried that and it worked great! Feel free to post as an answer if you like. Commented Feb 20, 2020 at 0:38

1 Answer 1

1

If your fixes are made on master branch then your current HEAD is master. I guess you have to checkout to branch A first and then make the conflict changes and then do a merge to master.

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.