This is an old revision of the document!
Overview
What makes a good Git commit?
Links:
Any other good ones?
Properties of a good Git commit
- Subject (first) line:
- 60 characters or less for pretty-printing (
git log --oneline) - Be accurate
- Include subsystem name at front if possible
- Use the imperative mood
- No ending period
- Commits themselves:
- Well-defined and modular, for future cherry picking or reverting.
- Complete; use
git commit --amendto assure this.
- Commit messages:
- What is being changed, what functionality is being affected (if any).
- Why it is being changed.
- References to discussions about this commit (people, mailing lists).
- Level of testing this commit has had.
- Names of others who have ACKed/tested/reviewed this commit.
- References to bug tracker items (JIRA) this commit is addressing.
Some examples
U-Boot
$ git show --summary 6ff005cf19363382fc867d7876a75fd8a386e894
commit 6ff005cf19363382fc867d7876a75fd8a386e894
Author: Dave Prue <dave@prue.com>
Date: Thu Aug 31 19:21:01 2017 +0200
sunxi: Fix CONFIG_SUNXI_GMAC references
SUNXI_GMAC was still used to configure the code where as the
same has been renamed and moved to Kconfig in below commit
"sunxi: Move SUNXI_GMAC to Kconfig"
(sha1: 4d43d065db3262f9a9918ba72457bf36dfb8e0bb)
Signed-off-by: Dave Prue <dave@prue.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Tested-by: Mark Kettenis <kettenis@openbsd.org>
[Tweek commit message, config_whitelist.txt, build-whitelist.sh]
Signed-off-by: Jagan Teki <jagan@openedev.com>
If several files are being touched, use git diff –stat to generate a summary, and add that info to the commit message. You can see this later with git show –stat:
$ git show --stat 6ff005cf19363382fc867d7876a75fd8a386e894
commit 6ff005cf19363382fc867d7876a75fd8a386e894
Author: Dave Prue <dave@prue.com>
Date: Thu Aug 31 19:21:01 2017 +0200
sunxi: Fix CONFIG_SUNXI_GMAC references
SUNXI_GMAC was still used to configure the code where as the
same has been renamed and moved to Kconfig in below commit
"sunxi: Move SUNXI_GMAC to Kconfig"
(sha1: 4d43d065db3262f9a9918ba72457bf36dfb8e0bb)
Signed-off-by: Dave Prue <dave@prue.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Tested-by: Mark Kettenis <kettenis@openbsd.org>
[Tweek commit message, config_whitelist.txt, build-whitelist.sh]
Signed-off-by: Jagan Teki <jagan@openedev.com>
arch/arm/include/asm/arch-sunxi/sys_proto.h | 2 +-
board/sunxi/Makefile | 2 +-
include/configs/sunxi-common.h | 2 +-
scripts/build-whitelist.sh | 4 ++--
scripts/config_whitelist.txt | 1 -
5 files changed, 5 insertions(+), 6 deletions(-)
$