'How do I fix overlapping Git Pull Requests?

I made changes to three files a, b, & c

I renamed the master branch to newWorkBranch and git add commit and push my work. I wanted to make some changes so the branch has not been merged on Github

Afterwards I made changes to file c for unrelated work and created a new otherBranch. When I git add commit and push files, all the work including the work from newWorkBranch is showing up as part of otherBranch

I need a way to:

  1. Disassociate newWorkBranch work from otherBranch including lines of code in file c
  2. Make sure I can keep making changes to branch newWorkBranch without further change
git


Solution 1:[1]

It sounds like you created otherBranch on top of newWorkBranch. To fix them so that they are independent of each other, you can use git rebase:

git checkout otherBranch
git rebase --onto origin/master newWorkBranch

This will effectively move all of the commits that you made on otherBranch which aren't on newWorkBranch so that they are on top of master.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Code-Apprentice