git日志提交规范

安装日志提交工具

https://github.com/commitizen/cz-cli

提交时添加日志前缀

  • Feat: 新功能(feature)
  • Fix: 修补bug
  • Docs: 修改文档(documentation)
  • Style: 样式(不影响代码运行的变动)
  • Refactor:重构(即不是新增功能,也不是修改bug的代码变动)
  • Perf:代码性能优化
  • Test: 增加测试
  • Chore: 构建过程或辅助工具的变动

查看日志

// 单行显示

git log --online
// 显示差异

git log --stat
// 简短日志(按提交者分组)

git shortlog
// 自定义格式输出,也可以使用占位符

git log --pretty=format:""
// 显示最新的 n 条日志

git log -
// 查找特定时间范围内的提交

git log --after="2021-07-1"
git log --before="2021-07-27"
git log --after="2021-07-1" --before="2021-07-27"
// 按照提交者查询

git log --author=""

官方参考:https://git-scm.com/docs/pretty-formats
控制显示的记录格式,常用的格式占位符写法及其代表的意义如下:

'%H': commit hash

'%h': abbreviated commit hash

'%T': tree hash

'%t': abbreviated tree hash

'%P': parent hashes

'%p': abbreviated parent hashes

'%an': author name

'%aN': author name (respecting .mailmap, see git-shortlog or git-blame)

'%ae': author email

'%aE': author email (respecting .mailmap, see git-shortlog or git-blame)

'%ad': author date (format respects --date= option)

'%aD': author date, RFC2822 style

'%ar': author date, relative

'%at': author date, UNIX timestamp

'%ai': author date, ISO 8601-like format

'%aI': author date, strict ISO 8601 format

'%cn': committer name

'%cN': committer name (respecting .mailmap, see git-shortlog or git-blame)

'%ce': committer email

'%cE': committer email (respecting .mailmap, see git-shortlog or git-blame)

'%cd': committer date (format respects --date= option)

'%cD': committer date, RFC2822 style

'%cr': committer date, relative

'%ct': committer date, UNIX timestamp

'%ci': committer date, ISO 8601-like format

'%cI': committer date, strict ISO 8601 format

'%d': ref names, like the --decorate option of git-log

'%D': ref names without the " (", ")" wrapping.

'%e': encoding

'%s': subject

'%f': sanitized subject line, suitable for a filename

'%b': body

'%B': raw body (unwrapped subject and body)

'%N': commit notes

你可能感兴趣的:(git日志提交规范)