1

I had a branch I was working in. Another dev worked on another component of it in another branch. I was merging in his branch and master while he was developing. He merged it into master and now my PR is massive and includes all his changes and comments from his PR.

I tried to rebase from that branch but there's a ton of merge conflicts. Is there anyway to ignore those with GitHub or a Git branching trick? I'm using GitHub Enterprise as well.

Oscar Godson
  • 31,662
  • 41
  • 121
  • 201

2 Answers2

0

The ideas behind a PR are:

  • develop a feature in a dedicated branch
  • rebase that branch on top of the target branch you want to contribute to

So indeed, you need to rebase your branch on top of the target branch, which might be here master.
Make sure your branch doesn't include any intermediate merge from master (which would add all his changes), but that it is only rebased on top of master (which allows you to test your modifications on top of all others).

If your branch includes merge commits which brings every other modifications in your branch history (which is bad and prevent you to easily rebase said branch), do a:

git checkout yourBranch
git rebase --interactive master

And drop the merge commits. Only keep your commits.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

TIL: Github only rerenders the PR page when your branch is updated, not when the branch against which you're making the PR is updated (eg "master").

Assuming you've rebased on the master branch, git commit amend your branch, and push that, and you should see the PR page rerendered with just your commits, without listing others' commits.

Jamie Folsom
  • 1,287
  • 2
  • 10
  • 20