gerrit beginner advice needed
-
Hello, having a hard time understanding gerrit.
I've uploaded three commits. gerrit complains about mixed whitespace and other changes. So I tried to split up my commit into two and upload it again. But I just don't get it.
Here's what i've tried:mkdir gerritfetch cd gerritfetch git init git fetch ssh://dsavi@codereview.qt-project.org:29418/qt/qtbase refs/changes/42/627542/1 && git checkout -b change-627542 FETCH_HEAD git log
from the log, I copied my original commit message and kept it in a text editor
git rebase -i change-627542 git reset d870a4d0947a7
that's the second latest commit in the fetch
git add -p
now choosing only non-whitespace changes
git commit
adding my original commit message
git add -p
choosing all other changes
git commit
here i struggled ending the rebase, --continue gave my an error saying "missing arguments for edit", so i did
git rebase --quit git add remote gerrit ssh://codereview.qt-project.org/qt/qt5 git push gerrit HEAD:refs/for/dev
which fails with the error: ! [remote rejected] HEAD -> refs/for/dev (no common ancestry)
Obviously, I'm on the wrong path. What should I do instead?
-
You should rebase your changes on current HEAD. After git init you forgot to checkout dev. I normally don't use the checkout but the cherry-pick so I can work on current HEAD.
-
Thank you for the quick answer, Christian. To be honest, my git skills are still quite shaky.
So should I do this?mkdir gerritfetch cd gerritfetch git init git checkout -b my-fix origin/dev git fetch ssh://dsavi@codereview.qt-project.org:29418/qt/qtbase refs/changes/42/627542/1 && git checkout -b change-627542 FETCH_HEAD
This will trigger quite a big download. Could I just copy my existing local directory and fetch into that copy?
-
Thank you for the quick answer, Christian. To be honest, my git skills are still quite shaky.
So should I do this?mkdir gerritfetch cd gerritfetch git init git checkout -b my-fix origin/dev git fetch ssh://dsavi@codereview.qt-project.org:29418/qt/qtbase refs/changes/42/627542/1 && git checkout -b change-627542 FETCH_HEAD
This will trigger quite a big download. Could I just copy my existing local directory and fetch into that copy?
@gaess said in gerrit beginner advice needed:
Could I just copy my existing local directory and fetch into that copy?
If this is a git repo clone from official qt, yes - you can work there as I also do - there is no need for a checkout for a patch. Simply do a cherry-pick in your local git clone.
// pull to be on current git HEAD, not needed if your local copy is not that old git pull // cherry-pick patch to your local HEAD git fetch https://codereview.qt-project.org/qt/qtbase refs/changes/42/627542/1 && git cherry-pick FETCH_HEAD // modify the patch // ... and push your changes git push gerrit HEAD:refs/for/dev
/edit: when using the cherry-pick method you have to make sure all ancestors which might produce a merge conflict are cherry-picked before (in your case the two other patches)
-