Patch based Contribution

Here is how committing and merging will usually look for merging and pushing for tickets that follow the convention (if patch-based): Hypothetical CASSANDRA-12345 ticket is a cassandra-4.0 based bug fix that requires different code for cassandra-4.0, cassandra-4.1, and trunk. Contributor Jackie supplied a patch for the root branch (12345-4.0.patch), and patches for the remaining branches (12345-4.1.patch, 12345-5.0.patch, 12345-trunk.patch). On cassandra-4.0

  1. git am -3 12345-4.0.patch (any problem b/c of CHANGES.txt not merging anymore, fix it in place)
  2. ant realclean && ant jar (rebuild to make sure code compiles)
  3. git commit --amend (Notice this will squash the 4.0 applied patch into the forward merge commit) On cassandra-4.1
  4. git merge cassandra-4.0 -s ours --log
  5. git apply -3 12345-4.1.patch (any issue with CHANGES.txt : fix and git add CHANGES.txt)
  6. ant realclean && ant jar (rebuild to make sure code compiles)
  7. git commit --amend (Notice this will squash the 4.1 applied patch into the forward merge commit) On cassandra-5.0
  8. git merge cassandra-4.1 -s ours --log
  9. git apply -3 12345-5.0.patch (any issue with CHANGES.txt : fix and git add CHANGES.txt)
  10. ant realclean && ant jar check (rebuild to make sure code compiles)
  11. git commit --amend (Notice this will squash the 4.1 applied patch into the forward merge commit) On trunk
  12. git merge cassandra-5.0 -s ours --log
  13. git apply -3 12345-trunk.patch (any issue with CHANGES.txt : fix and git add CHANGES.txt)
  14. ant realclean && ant jar check (rebuild to make sure code compiles)
  15. git commit --amend (Notice this will squash the trunk applied patch into the forward merge commit) On any branch
  16. git push origin cassandra-4.0 cassandra-4.1 cassandra-5.0 trunk --atomic -n (dryrun check)
  17. git push origin cassandra-4.0 cassandra-4.1 cassandra-5.0 trunk --atomic

    Git branch based Contribution

    Same scenario, but a branch-based contribution: On cassandra-4.0
  18. git cherry-pick <sha-of-4.0-commit> (any problem b/c of CHANGES.txt not merging anymore, fix it in place)
  19. ant realclean && ant jar (rebuild to make sure code compiles) On cassandra-4.1
  20. git merge cassandra-4.0 -s ours --log
  21. git format-patch -1 <sha-of-4.1-commit> (alternative to format-patch and apply is cherry-pick -n)
  22. git apply -3 <sha-of-4.1-commit>.patch (any issue with CHANGES.txt : fix and git add CHANGES.txt)
  23. ant realclean && ant jar (rebuild to make sure code compiles)
  24. git commit --amend (Notice this will squash the 4.1 applied patch into the forward merge commit) On cassandra-5.0
  25. git merge cassandra-4.1 -s ours --log
  26. git format-patch -1 <sha-of-5.0-commit> (alternative to format-patch and apply is cherry-pick -n)
  27. git apply -3 <sha-of-5.0-commit>.patch (any issue with CHANGES.txt : fix and git add CHANGES.txt)
  28. ant realclean && ant jar check (rebuild to make sure code compiles)
  29. git commit --amend (Notice this will squash the 5.0 applied patch into the forward merge commit) On trunk
  30. git merge cassandra-5.0 -s ours --log
  31. git format-patch -1 <sha-of-trunk-commit> (alternative to format-patch and apply is cherry-pick -n)
  32. git apply -3 <sha-of-trunk-commit>.patch (any issue with CHANGES.txt : fix and git add CHANGES.txt)
  33. ant realclean && ant jar check (rebuild to make sure code compiles)
  34. git commit --amend (Notice this will squash the trunk applied patch into the forward merge commit) On any branch
  35. git push origin cassandra-4.0 cassandra-4.1 cassandra-5.0 trunk --atomic -n (dryrun check)
  36. git push origin cassandra-4.0 cassandra-4.1 cassandra-5.0 trunk --atomic

    Contributions only for release branches

    If the patch is for an older branch, and doesn’t impact later branches (such as trunk), we still need to merge up. On cassandra-4.0
  37. git cherry-pick <sha-of-4.0-commit> (any problem b/c of CHANGES.txt not merging anymore, fix it in place)
  38. ant realclean && ant jar (rebuild to make sure code compiles) On cassandra-4.1
  39. git merge cassandra-4.0 -s ours --log
  40. ant realclean && ant jar (rebuild to make sure code compiles) On cassandra-5.0
  41. git merge cassandra-4.1 -s ours --log
  42. ant realclean && ant jar check (rebuild to make sure code compiles) On trunk
  43. git merge cassandra-4.1 -s ours --log
  44. ant realclean && ant jar check (rebuild to make sure code compiles) On any branch
  45. git push origin cassandra-4.0 cassandra-4.1 trunk --atomic -n (dryrun check)
  46. git push origin cassandra-4.0 cassandra-4.1 trunk --atomic

    Tips