Versions Compared

Key

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

...

  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)

Sometimes you might have multiple commits on your working branch.  Each commit gets pushed into gerrit as a separate review.  When synchronizing with the tip of the remote repo, you'd want to rebase each of the commits.  I do so in the following steps:

  1. checkout the earliest commit into its separate temporary branch
    1. git checkout -b <temp branch> <commit-id>
  2. go to master and update it to the tip of the remote repo as shown above (using 'git pull')
  3. rebase the temp branch to master.  On the temp branch do
    1. git rebase master  (you can use -i option if you want to edit the list of changes)
  4. rebase the temp branch on your working branch (as shown above).
    1. git rebase -i <temp branch> <working branch>
      1. ensure to remove the commit of the temp branch from the commit list displayed by rebase.