Git strategy to backport bugfixes into older branches (cherry-pick vs. merge)

后端 未结 2 1120
谎友^
谎友^ 2020-12-29 06:26

We work as follows in our team:

  • we have only a master branch in our GitHub repo, it\'s not stable - thinks get pushed there each day; for stable r
2条回答
  •  时光说笑
    2020-12-29 06:29

    In open source projects that I've worked on, the consensus seems to be that fixes should land on master first, be tested there, and only then be back-ported to older releases. You can see this in how the Linux kernel does stable releases, for example: Developers submit patches for mainline but nominate them for inclusion in stable as well.

    When cherry-picking in this situation, you probably want to use the -x flag:

    When recording the commit, append a line that says "(cherry picked from commit ...)" to the original commit message in order to indicate which commit this change was cherry-picked from. This is done only for cherry picks without conflicts. ... [If] you are cherry-picking between two publicly visible branches (e.g. backporting a fix to a maintenance branch for an older release from a development branch), adding this information can be useful.

提交回复
热议问题