Multiple commits in pull requests

tempid picture tempid · Nov 20, 2013 · Viewed 9.7k times · Source

We have a dev branch and a release branch. Dev branch is where all the developers check-in the code. All builds are taken from the release branch. We're using Stash (Atlassian's Enteprise Git) and wanted to incorporate code reviews using pull requests.

When someone submits a pull request, it is automatically including all the changesets from the dev branch that are not already merged into the release branch, even if they're not from the user who is submitting the request. How can the developer submit a request only for their changes and not everyone else's? Is this how it's supposed to be?

I see two workarounds -

  1. Add individual branches for each developer so it picks up only their changes.
  2. Add multiple approvers if the pull request has commits from multiple developers.

What is the best practice?

Answer

Rog picture Rog · Nov 21, 2013

In addition to Robin's answer, the recommended approach is that each developer creates a branch for each feature that they work on, based on the development branch. Then the pull request that is created represents exactly the changes that represent a particular feature or change.

Once a pull request has been reviewed and merged into the development branch, the process you use for merging into your release branch is simplified and separate from the review process.

Stash's documentation on branching and Atlassian's git tutorials explain these concepts in more detail.