This is great! Origin and gerrit remotes disagreeing could potentially
cause havoc. saper and I went through some tutorials telling people to use
`git clone -o gerrit` when starting development, but this is much cleaner.
I added it to
https://www.mediawiki.org/wiki/Gerrit/Tutorial#Prepare_to_work_with_gerrit
For existing repos you wrote:
You'll need to perform an additional step to
migrate existing repositories.
In each repository, run the following commands:
git remote set-url origin $(git config --get remote.gerrit.url)
git remote rm gerrit
git review -s
If you don't do this, your first git review in each project after adding git
-
review.conf will do the git review -s step for you.
If you have local branches tracking a "gerrit" remote (because you followed
the git advice/lore to always begin feature work with
git checkout -b my_new_feature -t gerrit/master
) then they'll now be disconnected, and you'll
have empty sections for them in the project's ~/.config.
When you try to update your local master branch, git nicely tells you how
to fix this:
MyProjRepo% git pull --ff-only
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
*git branch --set-upstream-to=origin/**<branch>** master*
So do this for your local branches tracking the remote master on gerrit:
MyProjRepo% git branch --set-upstream-to origin/master master
MyProjRepo% git branch --set-upstream-to origin/master my_new_feature
etc.
--
=S Page