Hi, On Tue, Aug 24, 2021 at 6:40 PM Dietmar May <dietmar....@outlook.com> wrote:
> I uploaded a series of (basically independent) commits (ie. patchsets). > > Code compiles, but jenkins fails for code style issues (whitespace, line > length). > > All of the wikis I've seen, including the openocd patch guide, say to > > git commit --amend > git push review > > However, --amend only works with the last commit. > The git way to fix commits earlier than the latest one is to use interactive rebase (git rebase -i origin/master). Change the failed commits to e (use commit, but stop for amending). Then at each step of the rebase, the commit you want to change is the "latest", so you can fix the files and git commit --amend as per the guide. Then git rebase --continue to go on to the next step of the rebase. If you mess anything up and want to get back to where you were, git rebase --abort will do that. > So I would then create a number of new branches, and then check them out > one at a time, cherry picking a single commit from my existing branch. > Separate branches are preferred if the changes are truly independent. If they are related you can stack them on top of each other if you want. If they are dependent on each other, they of course must be on the same branch. > > Even after jenkins is happy, I would still keep each of those branches > on my local repo until the associated change / commit has been accepted > by the openocd project, in case there are any changes needed due to code > review. > You can always check out the exact commit you pushed to gerrit, so there's no real need to keep them around. /Andreas