1

This is interesting question (or at least I hope it is). I have been working on feature and have git branch with those changes.

I need to create pull request to master (which I have rebased, I can revert) but my collages are complaining that pull request is too big and should be split on more pull requests.

Essentially I need to split my commits on branch A to branches B, C, D to have smaller pull requests. Does anybody know good approach to this problem?

Haris Krajina
  • 13,161
  • 12
  • 56
  • 75

1 Answers1

1

The easiest way might be to create a new branch at a past point, that will make the diff not too big to be hard to read, but at the same time not too small to be meaningless. Submit that branch as a pull request. After it's accepted, create a new branch from another point in between the previous one and your HEAD. Repeat until you reach HEAD. It's important to do this step by step, sending pull requests in sequence, not in parallel, otherwise reviewers will see code they have already seen in another parallel pull request, which is annoying.

Another way can be to create a new branch with all your changes but no commit history (squashed), and commit and create pull requests part by part, like this:

git checkout -b branchB origin/master
git merge --squash --no-commit branchA

After this you can commit parts of the changes, and create a pull request. After that's accepted, commit more of the changes, and create another pull request, and so on. Just be careful, make sure that the parts you have committed can work without the rest. It's easy to make a mistake and end up with a branch that only works for you, with your uncommitted changes not yet in the branch.

janos
  • 109,862
  • 22
  • 193
  • 214
  • Thank you, yes part of splitting commits into working branches is part that is trickiest. Will have to go one of these paths thanks again. – Haris Krajina Jul 06 '14 at 22:20