Document the new commit-msg hook supplied by Gerrit
Change-Id: Ide25706bcc9956159b5f0a194e6e4151ef058e90 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
57
Documentation/cmd-hook-commit-msg.txt
Normal file
57
Documentation/cmd-hook-commit-msg.txt
Normal file
@@ -0,0 +1,57 @@
|
||||
commit-msg Hook
|
||||
===============
|
||||
|
||||
NAME
|
||||
----
|
||||
commit-msg - Edit commit messages to insert a `Change-Id` tag.
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
A Git hook automatically invoked by `git commit`, and most other
|
||||
commit creation tools such as `git citool` or `git gui`. The Gerrit
|
||||
Code Review implementation of this hook is a short shell script
|
||||
which automatically inserts a globally unique `Change-Id` tag in
|
||||
the footer of a commit message, providing Gerrit with a way to
|
||||
track commits across rebases.
|
||||
|
||||
Once installed in the user's local Git repository for a project,
|
||||
the hook will rewrite a commit message such as:
|
||||
|
||||
====
|
||||
Improve foo widget by attaching a bar.
|
||||
|
||||
We want a bar, because it improves the foo by providing more
|
||||
wizbangery to the dowhatimeanery.
|
||||
|
||||
Signed-off-by: A. U. Thor <author@example.com>
|
||||
====
|
||||
|
||||
into the following message:
|
||||
|
||||
====
|
||||
Improve foo widget by attaching a bar.
|
||||
|
||||
We want a bar, because it improves the foo by providing more
|
||||
wizbangery to the dowhatimeanery.
|
||||
|
||||
Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf5b
|
||||
Signed-off-by: A. U. Thor <author@example.com>
|
||||
====
|
||||
|
||||
The hook is reasonably intelligent at inserting the Change-Id line
|
||||
before any Signed-off-by or Acked-by lines placed at the end of
|
||||
the commit message by the author, but if no such lines are present
|
||||
then it will just insert a blank line, and add the Change-Id at
|
||||
the bottom of the message.
|
||||
|
||||
OBTAINING
|
||||
---------
|
||||
To obtain the 'commit-msg' script use scp to copy it to your
|
||||
local system:
|
||||
|
||||
$ scp -P 29418 review.example.com:hooks/commit-msg .git/hooks
|
||||
|
||||
GERRIT
|
||||
------
|
||||
Part of link:index.html[Gerrit Code Review]
|
||||
@@ -14,6 +14,18 @@ To download a client command, use scp:
|
||||
|
||||
$ scp -P 29418 review.example.com:bin/gerrit-cherry-pick ~/bin
|
||||
|
||||
Client Hooks
|
||||
------------
|
||||
|
||||
Client hooks can be downloaded via scp, and installed into a local
|
||||
Git repository.
|
||||
|
||||
link:cmd-hook-commit-msg.html[commit-msg]::
|
||||
Automatically generate `Change-Id: ` tags in commit messages.
|
||||
|
||||
To download a client hook, use scp:
|
||||
|
||||
$ scp -P 29418 review.example.com:hooks/commit-msg .git/hooks
|
||||
|
||||
Executing Commands
|
||||
------------------
|
||||
|
||||
Reference in New Issue
Block a user