doc : gerrit_pracitces : fix line lengths
gerrit_practices.rst has style and formatting issues. Bringing them back in line with the recommended practices of the project. Change-Id: If76406e046ab376cea3e14c0e490e38587b34e6d Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
This commit is contained in:
parent
108aaf89ec
commit
58d39653dc
1 changed files with 77 additions and 55 deletions
|
@ -3,16 +3,19 @@
|
||||||
Gerrit Recommended Practices
|
Gerrit Recommended Practices
|
||||||
############################
|
############################
|
||||||
|
|
||||||
This document presents some best practices to help you use Gerrit more effectively.
|
This document presents some best practices to help you use Gerrit more
|
||||||
The intent is to show how content can be submitted easily. Use the recommended practices
|
effectively. The intent is to show how content can be submitted easily. Use the
|
||||||
to reduce your troubleshooting time and improve participation in the community.
|
recommended practices to reduce your troubleshooting time and improve
|
||||||
|
participation in the community.
|
||||||
|
|
||||||
Browsing the Git Tree
|
Browsing the Git Tree
|
||||||
*********************
|
*********************
|
||||||
|
|
||||||
Visit `Gerrit`_, then select :menuselection:`Projects --> List --> SELECT-PROJECT --> Branches`.
|
Visit `Gerrit`_, then select
|
||||||
Select the branch that interests you, click on :guilabel:`gitweb` located on the right-hand side.
|
:menuselection:`Projects --> List --> SELECT-PROJECT --> Branches`. Select
|
||||||
Now, :program:`gitweb` loads your selection on the Git web interface and redirects appropriately.
|
the branch that interests you, click on :guilabel:`gitweb` located on the
|
||||||
|
right-hand side. Now, :program:`gitweb` loads your selection on the Git web
|
||||||
|
interface and redirects appropriately.
|
||||||
|
|
||||||
.. _Gerrit: http://oic-review.01.org/gerrit/
|
.. _Gerrit: http://oic-review.01.org/gerrit/
|
||||||
|
|
||||||
|
@ -26,9 +29,9 @@ Select :guilabel:`Watched Projects` and then add any projects that interest you.
|
||||||
Commit Messages
|
Commit Messages
|
||||||
***************
|
***************
|
||||||
|
|
||||||
Gerrit follows the Git commit message format. Ensure the headers are at the bottom
|
Gerrit follows the Git commit message format. Ensure the headers are at the
|
||||||
and don't contain blank lines between one another. The following example shows the
|
bottom and don't contain blank lines between one another. The following example
|
||||||
format and content expected in a commit message:::
|
shows the format and content expected in a commit message:::
|
||||||
|
|
||||||
Subsystem: Brief one line description.
|
Subsystem: Brief one line description.
|
||||||
|
|
||||||
|
@ -39,8 +42,8 @@ format and content expected in a commit message:::
|
||||||
Signed-off-by: Your Name your.email@example.org
|
Signed-off-by: Your Name your.email@example.org
|
||||||
AnotherExampleHeader: An Example of another Value
|
AnotherExampleHeader: An Example of another Value
|
||||||
|
|
||||||
The Gerrit server provides a precommit hook to autogenerate the Change-Id which is one time use.
|
The Gerrit server provides a precommit hook to autogenerate the Change-Id which
|
||||||
Use the following command as an example:
|
is one time use. Use the following command as an example:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
|
@ -64,8 +67,10 @@ To avoid pushing untested work to Gerrit, we recommend you follow these steps:
|
||||||
$ git remote rename origin another-name
|
$ git remote rename origin another-name
|
||||||
|
|
||||||
- Use `precommit hooks`_ to scan for problematic words in your commit.
|
- Use `precommit hooks`_ to scan for problematic words in your commit.
|
||||||
Follow the installation instructions in the :file:`README.rst` for check patch.
|
Follow the installation instructions in the :file:`README.rst` for
|
||||||
Update the :literal:`checkarray` with keywords that might signal danger in your commits.
|
checkpatch.
|
||||||
|
Update the :literal:`checkarray` with keywords that might signal danger in
|
||||||
|
your commits.
|
||||||
|
|
||||||
.. _precommit hooks: https://github.com/niden/Git-Pre-Commit-Hook-for-certain-words
|
.. _precommit hooks: https://github.com/niden/Git-Pre-Commit-Hook-for-certain-words
|
||||||
|
|
||||||
|
@ -79,9 +84,13 @@ Keeping Track of Changes
|
||||||
|
|
||||||
* Set Gerrit to send you email:
|
* Set Gerrit to send you email:
|
||||||
|
|
||||||
- Gerrit will subscribe you to the mailing list created for that change if a developer adds you
|
- Gerrit will subscribe you to the mailing list created for that change if a
|
||||||
as a reviewer, or if you comment on a specific Patch Set.
|
developer adds you as a reviewer, or if you comment on a specific Patch
|
||||||
* Opening a change in Gerrit's review interface is a quick way to follow that change.
|
Set.
|
||||||
|
|
||||||
|
* Opening a change in Gerrit's review interface is a quick way to follow that
|
||||||
|
change.
|
||||||
|
|
||||||
* Watch projects in the Gerrit projects section at `Gerrit`_, select at least
|
* Watch projects in the Gerrit projects section at `Gerrit`_, select at least
|
||||||
*New Changes, New Patch Sets, All Comments* and *Submitted Changes*.
|
*New Changes, New Patch Sets, All Comments* and *Submitted Changes*.
|
||||||
|
|
||||||
|
@ -101,8 +110,8 @@ Emails contain some helpful headers for filtering:
|
||||||
|
|
||||||
- Autobuilders usually look like ``sys_EXAMPLE@intel.com``
|
- Autobuilders usually look like ``sys_EXAMPLE@intel.com``
|
||||||
|
|
||||||
Always track the projects you are working on; also see the feedback/comments mailing list
|
Always track the projects you are working on; also see the feedback/comments
|
||||||
to learn and help others ramp up.
|
mailing list to learn and help others ramp up.
|
||||||
|
|
||||||
|
|
||||||
Topic branches
|
Topic branches
|
||||||
|
@ -111,21 +120,23 @@ Topic branches
|
||||||
Topic branches are temporary branches that you push to commit a set of
|
Topic branches are temporary branches that you push to commit a set of
|
||||||
logically-grouped dependent commits:
|
logically-grouped dependent commits:
|
||||||
|
|
||||||
To push changes from :file:`REMOTE/master` tree to Gerrit for being reviewed as a topic
|
To push changes from :file:`REMOTE/master` tree to Gerrit for being reviewed as
|
||||||
in **TopicName** use the following command as an example:
|
a topic in **TopicName** use the following command as an example:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ git push REMOTE HEAD:refs/for/master/TopicName
|
$ git push REMOTE HEAD:refs/for/master/TopicName
|
||||||
|
|
||||||
The topic will show up in the review :abbr:`UI` and in the :guilabel:`Open Changes List`.
|
The topic will show up in the review :abbr:`UI` and in the
|
||||||
Topic branches will disappear from the master tree when its content is merged.
|
:guilabel:`Open Changes List`. Topic branches will disappear from the master
|
||||||
|
tree when its content is merged.
|
||||||
|
|
||||||
|
|
||||||
Creating a Cover Letter for a Topic
|
Creating a Cover Letter for a Topic
|
||||||
===================================
|
===================================
|
||||||
|
|
||||||
You may decide whether or not you'd like the cover letter to appear in the history.
|
You may decide whether or not you'd like the cover letter to appear in the
|
||||||
|
history.
|
||||||
|
|
||||||
1. To make a cover letter that appears in the history, use this command:
|
1. To make a cover letter that appears in the history, use this command:
|
||||||
|
|
||||||
|
@ -138,7 +149,7 @@ The command used doesn't change any files in the source tree.
|
||||||
|
|
||||||
2. To make a cover letter that doesn't appear in the history follow these steps:
|
2. To make a cover letter that doesn't appear in the history follow these steps:
|
||||||
* Put the empty commit at the end of your commits list so it can be ignored
|
* Put the empty commit at the end of your commits list so it can be ignored
|
||||||
without having to rebase.
|
without having to rebase.
|
||||||
* Now add your commits
|
* Now add your commits
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
@ -147,15 +158,16 @@ The command used doesn't change any files in the source tree.
|
||||||
$ git commit ...
|
$ git commit ...
|
||||||
$ git commit ...
|
$ git commit ...
|
||||||
|
|
||||||
* Finally, push the commits to a topic branch. The following command is an example:
|
* Finally, push the commits to a topic branch. The following command is an
|
||||||
|
example:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ git push REMOTE HEAD:refs/for/master/TopicName
|
$ git push REMOTE HEAD:refs/for/master/TopicName
|
||||||
|
|
||||||
If you already have commits but you want to set a cover letter, create an empty commit for
|
If you already have commits but you want to set a cover letter, create an empty
|
||||||
the cover letter and move the commit so it becomes the last commit on the list. Use the following
|
commit for the cover letter and move the commit so it becomes the last commit
|
||||||
command as an example:
|
on the list. Use the following command as an example:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
|
@ -174,7 +186,8 @@ Finding Available Topics
|
||||||
| grep topic: | sort -u
|
| grep topic: | sort -u
|
||||||
|
|
||||||
* *oic-review.01.org* Is the current URL where the project is hosted
|
* *oic-review.01.org* Is the current URL where the project is hosted
|
||||||
* *status* Indicates the topic's current status: open , merged, abandoned, draft, merge conflict.
|
* *status* Indicates the topic's current status: open , merged, abandoned,
|
||||||
|
draft, merge conflict.
|
||||||
* *project* Refers to the current name of the project, in this case forto-collab
|
* *project* Refers to the current name of the project, in this case forto-collab
|
||||||
* *branch* The topic is searched at this branch.
|
* *branch* The topic is searched at this branch.
|
||||||
* *topic* The name of an specific topic, leave it blank to include them all.
|
* *topic* The name of an specific topic, leave it blank to include them all.
|
||||||
|
@ -183,8 +196,8 @@ Finding Available Topics
|
||||||
Downloading or Checking Out a Change
|
Downloading or Checking Out a Change
|
||||||
************************************
|
************************************
|
||||||
|
|
||||||
In the review UI, on the top right corner, the **Download** link provides a list of commands and
|
In the review UI, on the top right corner, the **Download** link provides a
|
||||||
hyperlinks to checkout or download diffs or files.
|
list of commands and hyperlinks to checkout or download diffs or files.
|
||||||
|
|
||||||
We recommend the use of the *git review* plugin.
|
We recommend the use of the *git review* plugin.
|
||||||
The steps to install git review are beyond the scope of this document.
|
The steps to install git review are beyond the scope of this document.
|
||||||
|
@ -198,13 +211,15 @@ To check out a specific change using Git, the following command usually works:
|
||||||
|
|
||||||
$ git review -d CHANGEID
|
$ git review -d CHANGEID
|
||||||
|
|
||||||
If you don't have Git-review installed, the following commands will do the same thing:
|
If you don't have Git-review installed, the following commands will do the same
|
||||||
|
thing:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ git fetch REMOTE refs/changes/NN/CHANGEIDNN/VERSION \ && git checkout FETCH_HEAD
|
$ git fetch REMOTE refs/changes/NN/CHANGEIDNN/VERSION \ && git checkout FETCH_HEAD
|
||||||
|
|
||||||
For example, for the 4th version of change 2464, NN is 24 (the first two digits):
|
For example, for the 4th version of change 2464, NN is the first two digits
|
||||||
|
(24):
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
|
@ -214,8 +229,8 @@ For example, for the 4th version of change 2464, NN is 24 (the first two digits)
|
||||||
Using Draft Branches
|
Using Draft Branches
|
||||||
********************
|
********************
|
||||||
|
|
||||||
You can use draft branches to add specific reviewers before you publishing your change.
|
You can use draft branches to add specific reviewers before you publishing your
|
||||||
The Draft Branches are pushed to :file:`refs/drafts/master/TopicName`
|
change. The Draft Branches are pushed to :file:`refs/drafts/master/TopicName`
|
||||||
|
|
||||||
The next command ensures a local branch is created:
|
The next command ensures a local branch is created:
|
||||||
|
|
||||||
|
@ -235,8 +250,8 @@ The next command pushes your change to the drafts branch under **TopicName**:
|
||||||
Using Sandbox Branches
|
Using Sandbox Branches
|
||||||
**********************
|
**********************
|
||||||
|
|
||||||
You can create your own branches to develop features. The branches are pushed to the
|
You can create your own branches to develop features. The branches are pushed to
|
||||||
:file:`refs/sandbox/USERNAME/BRANCHNAME` location.
|
the :file:`refs/sandbox/USERNAME/BRANCHNAME` location.
|
||||||
|
|
||||||
These commands ensure the branch is created in Gerrit's server.
|
These commands ensure the branch is created in Gerrit's server.
|
||||||
|
|
||||||
|
@ -272,11 +287,13 @@ You can also push forcibly with review
|
||||||
Updating the Version of a Change
|
Updating the Version of a Change
|
||||||
*********************************
|
*********************************
|
||||||
|
|
||||||
During the review process, you might be asked to update your change. It is possible to submit
|
During the review process, you might be asked to update your change. It is
|
||||||
multiple versions of the same change. Each version of the change is called a patch set.
|
possible to submit multiple versions of the same change. Each version of the
|
||||||
|
change is called a patch set.
|
||||||
|
|
||||||
Always maintain the **Change-Id** that was assigned.
|
Always maintain the **Change-Id** that was assigned.
|
||||||
For example, there is a list of commits, **c0...c7**, which were submitted as a topic branch:
|
For example, there is a list of commits, **c0...c7**, which were submitted as a
|
||||||
|
topic branch:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
|
@ -288,17 +305,18 @@ For example, there is a list of commits, **c0...c7**, which were submitted as a
|
||||||
|
|
||||||
$ git push REMOTE HEAD:refs/for/master/SOMETOPIC
|
$ git push REMOTE HEAD:refs/for/master/SOMETOPIC
|
||||||
|
|
||||||
After you get reviewers' feedback, there are changes in **c3** and **c4** that must be fixed.
|
After you get reviewers' feedback, there are changes in **c3** and **c4** that
|
||||||
If the fix requires rebasing, rebasing changes the commit Ids, see the :ref:`rebasing` section
|
must be fixed. If the fix requires rebasing, rebasing changes the commit Ids,
|
||||||
for more information. However, you must keep the same Change-Id and push the changes again:
|
see the :ref:`rebasing` section for more information. However, you must keep
|
||||||
|
the same Change-Id and push the changes again:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ git push REMOTE HEAD:refs/for/master/SOMETOPIC
|
$ git push REMOTE HEAD:refs/for/master/SOMETOPIC
|
||||||
|
|
||||||
This new push creates a patches revision, your local history is then cleared. However you can
|
This new push creates a patches revision, your local history is then cleared.
|
||||||
still access the history of your changes in Gerrit on the :guilabel:`review UI` section, for each
|
However you can still access the history of your changes in Gerrit on the
|
||||||
change.
|
:guilabel:`review UI` section, for each change.
|
||||||
|
|
||||||
It is also permitted to add more commits when pushing new versions.
|
It is also permitted to add more commits when pushing new versions.
|
||||||
|
|
||||||
|
@ -307,8 +325,8 @@ It is also permitted to add more commits when pushing new versions.
|
||||||
Rebasing
|
Rebasing
|
||||||
********
|
********
|
||||||
|
|
||||||
Rebasing is usually the last step before pushing changes to Gerrit; this allows you to make the
|
Rebasing is usually the last step before pushing changes to Gerrit; this allows
|
||||||
necessary *Change-Ids*. The *Change-Ids* must be kept the same.
|
you to make the necessary *Change-Ids*. The *Change-Ids* must be kept the same.
|
||||||
|
|
||||||
* **squash:** mixes two or more commits into a single one.
|
* **squash:** mixes two or more commits into a single one.
|
||||||
* **reword:** changes the commit message.
|
* **reword:** changes the commit message.
|
||||||
|
@ -325,10 +343,11 @@ For more information you can visit `Atlasian`_ , `git book`_ and `git rebase`_.
|
||||||
Rebasing During a Pull
|
Rebasing During a Pull
|
||||||
**********************
|
**********************
|
||||||
|
|
||||||
Before pushing a rebase to your master, ensure that the history has a consecutive order.
|
Before pushing a rebase to your master, ensure that the history has a
|
||||||
|
consecutive order.
|
||||||
|
|
||||||
For example, your :file:`REMOTE/master` has the list of commits from **a0** to **a4**;
|
For example, your :file:`REMOTE/master` has the list of commits from **a0** to
|
||||||
Then, your changes **c0...c7** are on top of **a4**; thus:
|
**a4**; Then, your changes **c0...c7** are on top of **a4**; thus:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
|
@ -368,7 +387,8 @@ This pulls **a5-a7** and re-apply **c0-c7** on top of them:
|
||||||
Getting Better Logs from Git
|
Getting Better Logs from Git
|
||||||
****************************
|
****************************
|
||||||
|
|
||||||
Use these commands to change the configuration of Git in order to produce better logs:
|
Use these commands to change the configuration of Git in order to produce better
|
||||||
|
logs:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
|
@ -380,13 +400,15 @@ The command above sets the log to abbreviate the commits' hash.
|
||||||
|
|
||||||
$ git config log.abbrev 5
|
$ git config log.abbrev 5
|
||||||
|
|
||||||
The command above sets the abbreviation length to the last 5 characters of the hash.
|
The command above sets the abbreviation length to the last 5 characters of the
|
||||||
|
hash.
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ git config format.pretty oneline
|
$ git config format.pretty oneline
|
||||||
|
|
||||||
The command above avoids the insertion of an unnecessary line before the Author line.
|
The command above avoids the insertion of an unnecessary line before the Author
|
||||||
|
line.
|
||||||
|
|
||||||
To make these configuration changes specifically for the current Git user,
|
To make these configuration changes specifically for the current Git user,
|
||||||
you must add the path option :option:`–-global` to :command:`config` as follows:
|
you must add the path option :option:`–-global` to :command:`config` as follows:
|
||||||
|
@ -395,4 +417,4 @@ you must add the path option :option:`–-global` to :command:`config` as follow
|
||||||
|
|
||||||
$ git config –-global log.abbrevCommit true
|
$ git config –-global log.abbrevCommit true
|
||||||
$ git config –-global log.abbrev 5
|
$ git config –-global log.abbrev 5
|
||||||
$ git config –-global format.pretty oneline
|
$ git config –-global format.pretty oneline
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue