The tools being used should be subservient to developers needs, and since they are open source they can be fixed / improved. This is not a valid reason to avoid creating patch series. It might be mentioned that Gerrit's handling of patch series is not entirely perfect. Ensure no-op code refactoring is done separately from functional changes. Ensure whitespace changes are not mixed in with functional changes. Look out for commits which are mixing multiple logical changes and require the submitter to split them into separate commits. Review the commit message itself and request improvements to its content. In other words, when reviewing a change in Gerrit, do not simply look at the correctness of the code. This document intends to be the carrot by alerting people to the benefits, while anyone doing Gerrit code review can act as the stick -P Both a carrot & stick will be required to effect changes. If these guidelines were widely applied it would result in a significant improvement in the quality of the OpenStack Git history. The points and examples that will be raised in this document ought to clearly demonstrate the value in splitting up changes into a sequence of individual commits, and the importance in writing good commit messages to go along with them. The information provided in the commit message.The structured set/split of the code changes.This topic can be split into two areas of concern We can, however, come up with some general guidelines for what to do, or conversely what not to do, when publishing Git commits for merge with a project, in this case, OpenStack. Quality is a hard term to define in computing one person's "Thing of Beauty" is another's "Evil Hack". It is motivated by a desire to improve the quality of the Nova Git history. Examination of other open source projects such as the Kernel, CoreUtils, GNULIB and more suggested they all follow a fairly common practice. The following document is based on experience doing code development, bug troubleshooting and code review across a number of projects using Git, including libvirt, QEMU and OpenStack Nova. 1.3.2 Summary of Git commit message structure.1.2.1 Things to avoid when creating commits.If you do a git rebase -i without specifying a revision range you get all your unpushed commits, which is probably what you want to rebase anyways.The git interface doesn’t make this obvious, but you can also remove or reorder commits by removing or reordering the commit lines during the interactive rebase.The edit option is really only intended for when you want to add or remove files from an older commit, or split one. If you only want to change the commit message you can use r (for ‘reword’) rather than e (as I did in my examples). You can use the same technique to amend the author of the commit - git commit -amend -author "Name Goes Here".Some readers pointed out some additional valuable tips I did’t know about: git rebase -continueĭo this for each commit and your history is rewritten! 90644d6 Fourth Commit git commit -amendĪfter the message is changed you need to tell git to continue. In my case I simply needed to amend each commit to change the commit message. Once you are satisfied with your changes, run Git will now step through each of the commits you specified and ask you to make your changes. You now need to specify the commits you wish to edit – in my case this was the last four commits. Git will now show you the commits you specified – the last 5 in my case – in reverse order. To do this, we need to do an interactive rebase. I knew that I could amend a single commit with ‘git commit –amend’, but I’ve never had to rewrite the git history like this. Our usual convention is to add the story number to the commit message. I would see something like the following. Basically when I was looking at my git log: git log -oneline Today my pair and I were about to push multiple commits when I realized we had forgotten to add the story number to all of the commit messages.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |