Eliminación de desorden de GitHub PR después de la fusión de sucursales

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 y 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.

preguntado el 10 de septiembre de 13 a las 01:09

2 Respuestas

The ideas behind a PR son:

  • 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.

contestado el 23 de mayo de 17 a las 12:05

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.

Respondido 09 Oct 15, 14:10

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.