rrevo
rrevo

Reputation: 1777

How can I use gerrit to push a change as a remote branch to the git repo

I'm using a gerrit project that rebases changes to master. My workflow is

I wanted to submit a change and cause it to become a new remote branch rather than rebased onto master. Is this possible using Gerrit?

Upvotes: 6

Views: 11710

Answers (2)

Nogoseke
Nogoseke

Reputation: 1009

Create a Branch

There is command to create a branch:

ssh -p 29418 review.example.com gerrit create-branch myproject newbranch master

Reference

Or, you can do it like this:

git checkout master
git push origin HEAD:my_new_branch
git checkout my_new_branch
git push origin HEAD:/refs/for/my_new_branch

Push changes to the Branch

When pushing changes to gerrit use the -b flag with the new branch name. Otherwise gerrit will use the local branch name as a topic.

-b, --branch BRANCH Push to remote BRANCH

Upvotes: 14

Ilion
Ilion

Reputation: 6872

You can certainly still use remote branches. Depending on how your repository is configured they may or may not trigger a gerrit code review. Often that only happens when merging on the master branch.

Upvotes: 0

Related Questions