0

How can the order of feature branches be preserved?

For example, say that we have three feature branches: colby, swiss, and cheddar, which all must be merged into a dev branch.

The order must be maintained as written, as each feature branch depends on the previous. Also, each feature branch must be code-reviewed and properly documented before it can be merged.; that is:

                               --- cheddar ---\    
                 --- swiss ---\                \   
   --- colby ---\              \                \
--- dev ---------+--------------+----------------+->

Is it possible to sequence pull requests, and force them to be such that they are reviewed and merged in a specific order?

kmiklas
  • 13,085
  • 22
  • 67
  • 103
  • 1
    *Branches*, in Git, do not possess any kind of ordering. *Commits*, however, do, and a branch name identifies a commit—so you can test the underlying commits for ordering. But commits have only a *partial* order, not a total order, so there is no guarantee that there is a single answer to any `X < Y` test for any given commits `X` and `Y`. This is just background information for the next comment, since you've implied that you have carefully (and manually!) arranged for the *commits* to be presented in a total-order fashion. – torek Dec 02 '20 at 01:26
  • 2
    Now, the problem is that Git itself does not have pull requests—not, that is, in any form recognizable under the [tag:pull-request] tag. *Hosting sites* have them, but the hosting sites' mechanisms are peculiar to each hosting site. So your question cannot be answered definitively without adding which hosting site(s) you care about. – torek Dec 02 '20 at 01:28
  • 1
    "and force them to be reviewed and merged in a specific order?" Why force? Why not just agree? Your team mates are not your enemies. – matt Dec 02 '20 at 05:06
  • @matt yes "force" is too strong... fixed. – kmiklas Dec 02 '20 at 15:04
  • Okay, but then the pull requests _have_ a natural order, so why not just agree that they should be completed in that order? — That said, the whole question perhaps betrays a misconception. If it matters what order two pull requests are merged in, there is something fundamentally wrong with the workflow. – matt Dec 02 '20 at 15:07
  • With plain git I'd just name the branches "colby", "swiss-merge-after-colby", "cheddar-merge-after-swiss" – jthill Dec 02 '20 at 15:26

0 Answers0