问题
I'm using Gerrit to manage my git repository. Patches are sent to Gerrit server and merged into the git repository when they are approved. However, often a feature takes some time to develop and the developer wants to keep a backup of the code under development. The obvious solution is to push the branch directly to Gerrit, but then https://code.google.com/p/gerrit/issues/detail?id=1986 prevents me from submitting this branch to review.
A possible hack is to remove the remote branch when I want to submit it to review. A second one is to rebase the remote branch and update change IDs when I want to submit it to review.
How do you handle this problem?
回答1:
Have you tried the draft reference? It is useful when a code should backup, without listing it as an open patchset. Then if the code is ready it can be published. My suggestion is to avoid reviewing more then one commit. More commits/changes harder to be efficient on a review.
回答2:
The simplest way to fix this is to amend the commit. This will create a new commit that can then be pushed to another branch.
git commit --amend
git push origin HEAD:refs/for/master
来源:https://stackoverflow.com/questions/29703552/how-to-do-backup-of-development-branches-with-gerrit