Maintenance Releases:

(Using F-Maintenance release as an example here)

Overall Steps

Cherry-picking & Releasing

(Tasks must be performed in the correct order!)

How to Cherry Pick lots of commits as a single Squashed Commit

  • Checkout Release branch  (e.g. f-release)
  • $ git review –l
    • List reviews if exists
  • $ git review -d <change_id>
    • Download the review if exists)
  • $ git cherry-pick <commit_hash_3> <commit_hash_2> <commit_hash_1> ….
    • Cherry pick desired commits in order from oldest to youngest
  • $ git status
    • Check branch status to see how many commits your branch is ahead
  • $ git rebase -i HEAD~<diff_commit_count_number> (diff_commit_count_number: the number of commits cherrypicked in prev. step)
    • When the git edit window is opened, leave the pick on the first and replace 'pick' with 's' on the remaining commits.
      • :wq (to save/exit squashing (if using vi as git edit))
    • When the git edit window is opened for second time to edit commit messages, edit them all as you needed
      • :wq (to save/exit commit message editing (if using vi as git edit))
  • $ git status
    • Now you see that only one commit ahead
  • $ git commit –amend
    • You may change your commit message as you needed e.g. Patch set 2: Squash commits and cherry pick
  • $ git review --verbose --dry-run branchname
    • dry-run review operation before apply, Do not forget the branchname! e.g. f-release, be careful when pointing <parent_branch_info>
  • $ git review --verbose branchname
    • send your review that includes the squashed commit as a new patch set on the same change_id checked-out at ‘git review –d’ step above

Note about squashing cherrypicks

  • One issue with this approach is that the trail back to the original commit is lost.
  • The new squashed commit appears as a new standalone commit
  • With a 'standard' cherrypick each cherry-picked commit can still be tracked back to its original commit.
  • At the very least the commit message for the squashed commit should refer back to the change-IDs or commit-IDs of the original cherrypicked commit
  • No labels