Alter message in Gerrit code review
-
14-11-2019 - |
Question
I've commited a branch to gerrit. Moderators have already approved my code but not merged it yet into the main repository. I tried altering the message on my commit but I keep getting strange errors. Here's what I've done:
1) git checkout FETCH_HEAD (to checkout the latest changes to a branch, I had to run repo sync after I commited my changes which undid my changes so had to fetch and checkout to get my changes back)
2) git commit --amend *opens a text editor and I changed my message there
3) repo upload
When I try #3, it gives me this message: "no branches ready for upload"
I thought my doing a checkout that my branch would be called FETCH_HEAD? Now, do I need to run the repo start command again? Will this cause a new entry in the gerrit review system or will it just add a new patch? I don't want the moderators to have to think that I altered the files, thereby having them review everything again./ I just want to change the commit message, nothing else.
Any ideas what I am doing wrong?
Solution
I think repo upload
requires a tracked branch. When I had this problem, I switched back to the "master" branch and merged my changes into it. I was able to do the repo upload
from there.
OTHER TIPS
I think what you are missing is the --track option while creating a new branch. Your branch is being created but not being tracked for upload. use repo start as an alternative.
git checkout FETCH_HEAD
doesn't create a branch - instead, it puts your client into a "detached HEAD" state. You need to manually create a branch (with git checkout -b <branchname>
) if you want one.