Versions Compared

Key

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

...

After the hook is installed, every commit you make will get its own Change-Id. Without it, Gerrit will reject all patches.

Rebase Your Branch

Commit all outstanding changes:

Code Block
cd $IMPALA_HOME
git add --update
git commit

Rebase against asf-gerrit/master (good practice to catch conflicts introduced by recent commits)

Code Block
git fetch asf-gerrit
git rebase asf-gerrit/master

You might have to resolve merge conflicts during 'git rebase'. Follow the instructions, then continue with

Code Block
git rebase --continue

Squash everything down to a single commit:

Code Block
git rebase -i asf-gerrit/master

Make sure to pick only the first commit and 's' (squash) following lines, then edit the commit message into something coherent. Run the git log command to see that you're exactly one commit ahead of asf-gerrit/master

Info
titleTip

I have these helpers in my .bashrc to simplify branching from the latest trunk (branch-trunk my_new_branch) and rebase against the latest trunk (rebase-trunk).

Code Block
branch-master() {
  git fetch asf-gerrit && git checkout -b $1 asf-gerrit/master
}
alias "rebase-master"="git fetch asf-gerrit && git rebase -i asf-gerrit/master"
Warning

Do not push directly to asf-gerrit/master, or any other branch. This will bypass the code-review process.

Submitting a patch

To submit a patch for review, you should push it to a Gerrit-specific 'branch' on the Gerrit remote. That branch has the form refs/for/<branch-name>. For the vast majority of patches the target branch will be master, which is where all mainline development happens. During releases, release managers may push commits to a specific release branch, however most new development will happen on master.

...

... will push all commits between asf-gerrit/master and your HEAD. Please therefore make certain that you are only pushing the commits you want reviewed: every separate commit translates to an e-mail in everyone's inbox!

Merging a patch (Impala committers only!)

Once a change has a +2 and has been verified by a pre-merge verification run, it can be submitted to gerrit. Once it is in is gerrit, a committer needs to push the commit to the Apache git repository, by running:

Code Block
bin/push_to_asf.py

push_to_asf.py checks the latest commits in gerrit and checks if they are in the Apache git repo. If some are not in the Apache git repo yet, it will ask you if you want to update the Apache git repo with the missing commits found in the Gerrit repo. It does not check what your local state is at all. It only compares remote Gerrit with the remote Apache repo. Keep in mind that if you are a committer, it will allow you to commit any change authored by anyone that has passed GVO.

Git and Gerrit etiquette

Contribution guidelines

...

As described above, Gerrit generates one review request per new commit. It's much easier to review everything related to a patch together in one single commit, so please make sure to squash all your related commits together before submitting. If you don't, your review requests will probably get forcibly removed.