Trying to make a change to an existing wip gerrit change but it seems to be picking up a different change for some reason and is failing. I even tried deleting my local copy of git haiku, pulling down all of the haiku sources again, making my change, and redoing. Same issue. Notice any problems here?
Your screenshot doesn’t really make it obvious to me what you are doing.
So here my afaik instructions for ammending gerrit commits:
you can download a change from gerrit using the downlod button on gerrit, and then clicking the clipboard to copy the cherry pick intructions. And use that to download it.
After that you can use git commit --amend and add the Change-ID line you see in the web overview of the commit to the commit message. That should let you push it to the correct change then.
Edit: if you only want to replace a change that is on gerrit without needing the commit you can use only the change-id line in the commit message and skip the cherry picking.
Thanks for the tip.
I was able to resolve by:
git fetch “ssh://Coldfirex@git.haiku-os.org/haiku” refs/changes/16/4216/4 && git cherry-pick FETCH_HEAD
The “git commit --amend” command is used to modify the last commit. In your screenshot, here is the sequence of actions you have taken:
- Clone the Haiku sources as it is currently in the master branch
- Install the git commit hook that will generate new change-ids when you make new commits
- Go into the checkout directory and run the configure script so you can compile haiku
- Change the URL you are using to communicate with the Haiku git server (not sure why you are doing this? and you are setting it to the same URL you just cloned from, so it won’t do anything anyways)
- Attempt to abort a cherry-pick. Again, I am confused, because you had no cherry-pick in progress at this point, why would you try to abort one?
- Add a directory to your staged changes (ready to be added to the next commit)
- Modify the latest commit that’s already in the master branch (and which is unrelated to what you were working on, it is an update of haikuwebkit). You have a bash comment on that line, but, being a comment, it is completely ignored. Were you trying to reference a specific commit at this point?
- Attempt to push that modified commit for review, which isn’t allowed because the commit is already in the master branch
Here is what I think you should have done:
- Clone the repository and setup the hooks (assuming you deleted everything already, it is of course not needed to redo this all the time, only once to get the initial setup)
- Download your previously submitted change back from Gerrit if you don’t have it locally anymore: git fetch “ssh://Coldfirex@git.haiku-os.org/haiku” refs/changes/16/4216/4 && git cherry-pick FETCH_HEAD
- Make your changes
- git add + git commit --amend to modify the commit
- git push origin HEAD:refs/for/master to push the commit (referenced as “HEAD”) for review (referenced as “refs/for/master”) on the Haiku Gerrit server (referenced as “origin”)
Thanks fro the details response as always!
Good to know about changing the URL. I didnt realize.
Cherry-pick. Because I don’t have a good understanding of it.
Ya, it popping up this other change was confusing me too. Using the git fetch command though above squared that away.
Again, thanks for the response. I have been piecemealing my notes together from the Haiku directions we have as well as google, etc to be able to handle this.
Just queued up some beginner Git videos in Pluralsight that hopefully will help with “the big picture” on having a better understanding.