Luke Gedeon
Luke Gedeon

Reputation: 902

How can I create a PR in github that only shows changes in a single branch?

Now branch "B" is showing all the commits from "A" as if they were part of "B"

Any suggestions on how to get a clean PR/branch with just the changes to branch "B"?

Upvotes: 1

Views: 48

Answers (1)

VonC
VonC

Reputation: 1327004

how to get a clean PR/branch with just the changes to branch "B"

Fetch from upstream (the original repository) in order to get an updated upstream/master (one with PR from A merged and accepted)

Reset your own master to upstream/master.

Create a new branch and rebase B commits onto it:

 m--m--m--m       (master, upstream/master)
    \
     a--a--a      (A)
         \
          b--b--b (B)

git rebase --onto master $(git merge-base A B) B

            b'--b'--b' (B)
           /
 m--m--m--m       (master, upstream/master)
    \
     a--a--a      (A)

From there, you can force push B, and do your PR from there.

Upvotes: 1

Related Questions