amending a change on BRANCH_X results in new change in master

Bug #1007915 reported by Nischay
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
git-review
New
Undecided
Unassigned

Bug Description

I tried to

git commit -m "message"
git review BRANCH_X

git review -d <change number>
git add some/dir/file.txt
git commit --amend
git review -R

Resulted in a new change in branch master rather than amending the change in BRANCH_X

How I deal with it

git review -d <change number>
git add some/dir/file.txt
git commit --amend
git review BRANCH_X -R

since I am reviewing a change shouldn't git review commit it to BRANCH_X by itself ??

Tags: amend
Revision history for this message
Jeremy Stanley (fungi) wrote :

git-review assumes a topic branch workflow, and uses the local branch name to set the change topic in Gerrit. Normally you should specify the target branch when running git review, unless you intend to push to the default branch specified in the project's .gitreview file.

The way I usually end up doing what you describe (for backporting patches to stable release branches) is to cherry-pick them into a local checkout of that branch, and rely on the .gitreview file to specify the corresponding remote branch name or add it onto the end of the command line. This way -R is not needed when submitting. Also note that 1.21 now includes several cherry-pick methods as alternatives to -d, which makes this process easier.

There is another wishlist bug more specifically about guessing the default branch based on the local branch without needing per-branch overrides in .gitreview, so I'm flagging this as a duplicate of it.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.