Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create a branch off the commit that you want to change
    1. git checkout -b <temporary branch> <commit-id>
  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 --amend -av
      1. Follow the guidelines for the commit message
      2. This will commit and merge your changes with the original commit
    3. Alternatively, a more manual way of achieving the "git commit --amend -av" is as following
      1. git commit -av
      2. 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.
    1. At this point the git repo will have the temp branch.  Using the same example above, I needed to edit the commit: LU-2456 lnet: DLC libyaml code.  So I created a branch based on that commit, made the changes and committed on the temp branch.  Notice that now the same commit exist on both the temp and dlc_6 (working) branch.  The one on the temp branch is the modified one.  Next step is to pull that into the dlc_6 branch.
  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.
        2. Continuing from the same example, below is a screen capture of the interactive rebase vi session
          1. Now you need to delete the first line, so that the rebase uses the modified patch
    3. After this is complete, all your commits which depend on the change you just made will be rebased on your changes.
      1. Continuing the same example, below is a screen capture of what the git repo looks like
  7. Now that you're on your working branch, delete your temporary branch
    1. git branch -d <temporary branch>
      1. Continuing the same example, below is a screen capture of what the git repo looks like.  Note, it looks exactly the same as what you started with
  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.

Rebasing On Master

As work on the working branch goes on, there will come a time when we need to rebase on the latest and greatest.

  1. On the master branch do:
    1. git pull
  2. On the working branch do:
    1. git rebase master  (you can use -i option if you want to edit the list of changes)