Skip to content
Snippets Groups Projects
Forked from Maunium / synapse
5790 commits behind the upstream repository.
  • Dan Callahan's avatar
    7dc14730
    Name release branches just after major.minor (#10013) · 7dc14730
    Dan Callahan authored
    
    With the prior format, 1.33.0 / 1.33.1 / 1.33.2 got separate branches:
    
        release-v1.33.0
        release-v1.33.1
        release-v1.33.2
    
    Under the new model, all three would share a common branch:
    
        release-v1.33
    
    As before, RCs and actual releases exist as tags on these branches.
    
    This better reflects our support model, e.g., that the "1.33" series had
    a formal release followed by two patches / updates.
    
    Signed-off-by: default avatarDan Callahan <danc@element.io>
    Name release branches just after major.minor (#10013)
    Dan Callahan authored
    
    With the prior format, 1.33.0 / 1.33.1 / 1.33.2 got separate branches:
    
        release-v1.33.0
        release-v1.33.1
        release-v1.33.2
    
    Under the new model, all three would share a common branch:
    
        release-v1.33
    
    As before, RCs and actual releases exist as tags on these branches.
    
    This better reflects our support model, e.g., that the "1.33" series had
    a formal release followed by two patches / updates.
    
    Signed-off-by: default avatarDan Callahan <danc@element.io>
git.md 6.96 KiB

Some notes on how we use git

On keeping the commit history clean

In an ideal world, our git commit history would be a linear progression of commits each of which contains a single change building on what came before. Here, by way of an arbitrary example, is the top of git log --graph b2dba0607:

clean git graph

Note how the commit comment explains clearly what is changing and why. Also note the absence of merge commits, as well as the absence of commits called things like (to pick a few culprits): “pep8”, “fix broken test”, “oops”, “typo”, or “Who's the president?”.

There are a number of reasons why keeping a clean commit history is a good thing:

  • From time to time, after a change lands, it turns out to be necessary to revert it, or to backport it to a release branch. Those operations are much easier when the change is contained in a single commit.

  • Similarly, it's much easier to answer questions like “is the fix for /publicRooms on the release branch?” if that change consists of a single commit.

  • Likewise: “what has changed on this branch in the last week?” is much clearer without merges and “pep8” commits everywhere.

  • Sometimes we need to figure out where a bug got introduced, or some behaviour changed. One way of doing that is with git bisect: pick an arbitrary commit between the known good point and the known bad point, and see how the code behaves. However, that strategy fails if the commit you chose is the middle of someone's epic branch in which they broke the world before putting it back together again.

One counterargument is that it is sometimes useful to see how a PR evolved as it went through review cycles. This is true, but that information is always available via the GitHub UI (or via the little-known refs/pull namespace).

Of course, in reality, things are more complicated than that. We have release branches as well as develop and master, and we deliberately merge changes between them. Bugs often slip through and have to be fixed later. That's all fine: this not a cast-iron rule which must be obeyed, but an ideal to aim towards.

Merges, squashes, rebases: wtf?