Work Flow for "Git + Gerrit"
11 December 2015
Above picture illustrates the basic work flow of software development using git + gerrit. Below are some frequently used commands for your reference.
- Clone repository
- Copying the hook script allows git to create a unique ID for each commit. That ID is correlated with gerrit review topics.
- Commit locally
- It is highly recommended to run
git status
andgit diff --cached
etc. betweengit add xxx
andgit commit
to ensure nothing committed inadvertantly. - Review
- Run
git push origin refs/for/<branch_name>
where<branch_name>
is your current branch. - Submit
- Click the "submit" button on corresponding gerrit webpage.
- NOTE: You may also need to "cherry-pick" the code change to other branches on the same webpage.
- Recommit
- The key is to keep commit ID intact. Most times, this is done by
simply git add what we've changed per review and run
git commit --amend
. - Update local repository
git pull --rebase
.- The option
--rebase
is the key to pull new code to local without creating a "merge …" commit. - Actually, you may rebase your code whenever you want (so long as you commit all your changes locally).
- The option
blog comments powered by Disqus