User:SPage (WMF)/Git & gerrit day-to-day

Suggestions for daily workflow
You've gone through Git/Tutorial, you've read Git/Workflow (and stumbled over all the places they disagree or are subtly different), you've made a commit and maybe even got it through git review. But MediaWiki's combination of git and gerrit will still This section is an opinionated guide to avoiding these problems.

Work with 'gerrit' over ssh

 * Follow Git/Workflow to set up the gerrit ssh shortcut.
 * Follow Git/Workflow#Prepare to work with gerrit. Note git clone -o gerrit to avoid "origin" creeping in.

Principles

 * never work on local master
 * Always have local branches tracking gerrit/master
 * Work in local work branches, committing all the time.
 * For git review, create a new branch just for your fix and squash your local changes to it.

day-to-day git
First get your local master up to sp This is better than git pull because you're telling it what to do.
 * Start work on a local branch for some new feature

If rebase fails, blow it off.
 * git rebase master your work branch periodically

gerrit
After a while your "my/newawesome" work branch should have lots of commits.

But gerrit wants a single commit. So start a new branch just to hold the one change for gerrit, and merge to it: That last step should merge your local work into this feature/newcss as one commit, and then you can `git review` it.

Editorial
It is pathetic that this workflow isn't clearly explained anywhere. The problem is the git experts disagree on the details (is it gerrit or origin or review that you work from? do you use pull or separate steps?) and so no shit gets clearly explained, you're just in a maze of copy-pasted best practices