You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Below is a recommended workflow when committing multiple related patches into Gerrit.

Initial Push into Gerrit

  1. Create a commit plan.  If you're making a lot of changes to the code, decide how you plan to break these changes into patches.
  2. Create your working branch off of master
    1. git checkout -b <working branch>
  3. Make the changes according to your plan, and as you finish each patch commit into your working branch. 
    1. git add <files>
    2. git commit -av
      1. Follow the guidelines for comments, etc, as already documented.
  4. After you're done all your patches, you'll have a git repo that looks something like the following.  The example used is from the DLC project.
      1. You'll notice that there are nine commits on the branch dlc_6, which is based off master
  5. Make sure that every patch by itself can be compiled, run and pass autotest (although you won't know the latter until you push into gerrit, unless you're able to run the autotest on your local machines)
  6. Now you can push into gerrit.
    1. git push ssh://<username>@review.whamcloud.com:29418/fs/lustre-release HEAD:refs/for/master
    2. Gerrit will recognize each commit and create a different patch for it.

Addressing Inspection Comments

Now that you submitted your code into gerrit, you'll most likely start getting comments on the different patches.  You'll need to update the separate patches and probably rebase all the patches which depend on the patch you have changed.  Below is a work flow to aid you in this process.

  1. Create a branch off the commit that you want to change
    1. git branch <temporary branch> <commit-id>
    2. git checkout <temporary branch>
  2. Now that you're on the <temporary branch>, start addressing the inspection comments
  3. git status
    1. Will show the changes you've made
  4. Now commit and rebase your changes on that temporary branch, so you don't have multiple commits.
    1. git add <files>
    2. git commit -av
      1. Follow the guidelines for the commit message
    3. git rebase -i HEAD~2
      1. This will show you the previous commit and the your recent commit to address the inspection comment
      2. Change the commit for the inspection changes from "pick" to "fixup"
        1. This will collapse the inspection commit into the original commit
  5. Compile and make sure your fixes are good.
  6. Rebase your changes from the <temporary branch> back into your main working branch
    1. git rebase -i <temporary branch> <working branch>
    2. delete the redundant commit that  you're pulling in from your temporary branch
      1. basically this step is saying, I don't want to use the commit that currently exists on my working branch, I want to replace it with the commit from my temporary branch, which I have made some changes to.
        1. Note that the order git displays the commit while doing interactive rebase is from oldest to newest.  you probably want to keep the same order.
    3. After this is complete, all your commits which depend on the change you just made will be rebased on your changes.
  7. Now that you're on your working branch, delete your temporary branch
    1. git branch -d <temporary branch>
  8. From your working branch push into Gerrit
    1. git push ssh://<username>@review.whamcloud.com:29418/fs/lustre-release HEAD:refs/for/master
    2. Gerrit will recognize which patches has changed and update them appropriately.
  9. Now you're ready for more inspection comments.  This process can be repeated until the patches pass inspection.
  • No labels