162306a36Sopenharmony_ciConfiguring Git
262306a36Sopenharmony_ci===============
362306a36Sopenharmony_ci
462306a36Sopenharmony_ciThis chapter describes maintainer level git configuration.
562306a36Sopenharmony_ci
662306a36Sopenharmony_ciTagged branches used in pull requests (see
762306a36Sopenharmony_ciDocumentation/maintainer/pull-requests.rst) should be signed with the
862306a36Sopenharmony_cidevelopers public GPG key. Signed tags can be created by passing
962306a36Sopenharmony_ci``-u <key-id>`` to ``git tag``. However, since you would *usually* use the same
1062306a36Sopenharmony_cikey for the project, you can set it in the configuration and use the ``-s``
1162306a36Sopenharmony_ciflag. To set the default ``key-id`` use::
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci	git config user.signingkey "keyname"
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciAlternatively, edit your ``.git/config`` or ``~/.gitconfig`` file by hand::
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci	[user]
1862306a36Sopenharmony_ci		name = Jane Developer
1962306a36Sopenharmony_ci		email = jd@domain.org
2062306a36Sopenharmony_ci		signingkey = jd@domain.org
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ciYou may need to tell ``git`` to use ``gpg2``::
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci	[gpg]
2562306a36Sopenharmony_ci		program = /path/to/gpg2
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ciYou may also like to tell ``gpg`` which ``tty`` to use (add to your shell
2862306a36Sopenharmony_circ file)::
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci	export GPG_TTY=$(tty)
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciCreating commit links to lore.kernel.org
3462306a36Sopenharmony_ci----------------------------------------
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ciThe web site https://lore.kernel.org is meant as a grand archive of all mail
3762306a36Sopenharmony_cilist traffic concerning or influencing the kernel development. Storing archives
3862306a36Sopenharmony_ciof patches here is a recommended practice, and when a maintainer applies a
3962306a36Sopenharmony_cipatch to a subsystem tree, it is a good idea to provide a Link: tag with a
4062306a36Sopenharmony_cireference back to the lore archive so that people that browse the commit
4162306a36Sopenharmony_cihistory can find related discussions and rationale behind a certain change.
4262306a36Sopenharmony_ciThe link tag will look like this::
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci    Link: https://lore.kernel.org/r/<message-id>
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ciThis can be configured to happen automatically any time you issue ``git am``
4762306a36Sopenharmony_ciby adding the following hook into your git::
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci	$ git config am.messageid true
5062306a36Sopenharmony_ci	$ cat >.git/hooks/applypatch-msg <<'EOF'
5162306a36Sopenharmony_ci	#!/bin/sh
5262306a36Sopenharmony_ci	. git-sh-setup
5362306a36Sopenharmony_ci	perl -pi -e 's|^Message-I[dD]:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1"
5462306a36Sopenharmony_ci	test -x "$GIT_DIR/hooks/commit-msg" &&
5562306a36Sopenharmony_ci		exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
5662306a36Sopenharmony_ci	:
5762306a36Sopenharmony_ci	EOF
5862306a36Sopenharmony_ci	$ chmod a+x .git/hooks/applypatch-msg
59