- GitHub - mirrors of the code we've written for the robotics team reside here.
- Gerrit - we use Gerrit, which is based on Git, for code review.
- Git's online documentation.
- Git (advanced usage) lecture slides.
gerrit.frc3512.com and sign in / sign up.
Create SSH key pair
ssh-keygen -t rsa -b 4096 -C "email@example.com"
Add public key to Gerrit
Copy the entire block, then navigate to the "SSH Public Key" settings of your user settings on Gerrit. Click "Add Key", paste the entire key, then click "Add".
pacman -S python wget https://bootstrap.pypa.io/get-pip.py python get-pip.py pip install --user git-review
Configuring cloned repository
git clone ssh://firstname.lastname@example.org:29418/Robot-2017 cd Robot-2017 git review -s
In Gerrit, features are submitted in branches with one commit per branch. Give each branch a name reflecting its content for easier management. Submit new patchsets and revisions of existing patchsets via the following command.
Gerrit manages reviews on a per-commit basis. To start a review on a new
patch, make sure the commit is on a separate branch from master. Check out
that branch and run
Make sure new patchsets are created with
git commit. Using
git commit --amend will change a commit already merged
upstream and lead to conflicts.
Revisions to patchset
Any changes should be incorporated into the commit previously pushed by either amending or rebasing (not pushing a new commit on top of the old one). Gerrit tracks the revisions using the "Change-Id" line at the bottom of the commit message. Make sure this line does not change and remains the last line during commit message modifications. Otherwise, a new patchset will be created instead.
Verify this was done correctly by inspecting the output of
master..HEAD. There should be only one commit listed and its
Change-Id should match the old one.
git commit --amend
Squashing committed changes
If a new commit or commits were made while working, they should be squashed into the first before submitting it all as a new revision. To do so, run
git rebase -i <commit hash before your commits>
The first commit in the resulting generated file should be set to "r"
for "reword" if the commit message needs to be altered to include parts of
the other two commits. The other commits should be set to "f" for "fixup"
so their contents are squashed into the first commit.
rebase descriptions for other options are in the file comment.
To clarify, making a new commit on top of it then running
review will make a new patchset. This is bad practice as the new
commit is not a stand-alone feature.