# git-shortlog
> 原文: [https://git-scm.com/docs/git-shortlog](https://git-scm.com/docs/git-shortlog)
## 名稱
git-shortlog - 匯總 _git log_ 輸出
## 概要
```
git shortlog [<options>] [<revision range>] [[--] <path>…?]
git log --pretty=short | git shortlog [<options>]
```
## 描述
以適合包含在發布公告中的格式匯總 _git log_ 輸出。每個提交將按作者和標題分組。
此外,“[PATCH]”將從提交說明中刪除。
如果命令行上沒有傳遞任何修訂,并且標準輸入不是終端或者沒有當前分支, _git shortlog_ 將輸出從標準輸入讀取的日志摘要,而不引用當前存儲庫。
## OPTIONS
```
-n
```
```
--numbered
```
根據每位作者的提交次數而不是作者字母順序對輸出進行排序。
```
-s
```
```
--summary
```
禁止提交描述并僅提供提交計數摘要。
```
-e
```
```
--email
```
顯示每位作者的電子郵件地址。
```
--format[=<format>]
```
而不是提交主題,使用一些其他信息來描述每個提交。 _< format>_ 可以是 _git log_ 的`--format`選項接受的任何字符串,例如 _* [%h]%s_ 。 (參見 [git-log [1]](https://git-scm.com/docs/git-log) 的“PRETTY FORMATS”部分。)
```
Each pretty-printed commit will be rewrapped before it is shown.
```
```
-c
```
```
--committer
```
收集并顯示提交者身份而不是作者。
```
-w[<width>[,<indent1>[,<indent2>]]]
```
通過在`width`處包裹每一行來包裝輸出。每個條目的第一行由`indent1`空格縮進,第二行和后續行由`indent2`空格縮進。 `width`,`indent1`和`indent2`分別默認為76,6和9。
如果width是`0`(零),則縮進輸出行而不包裝它們。
```
<revision range>
```
僅顯示指定修訂范圍內的提交。當沒有<修訂范圍>如果指定,則默認為`HEAD`(即導致當前提交的整個歷史記錄)。 `origin..HEAD`指定從當前提交可以訪問的所有提交(即`HEAD`),但不是`origin`。有關拼寫< revision range>的完整列表,請參閱 [gitrevisions [7]](https://git-scm.com/docs/gitrevisions) 的“指定范圍”部分。
```
[--] <path>…?
```
只考慮足以解釋與指定路徑匹配的文件的提交。
當出現混淆時,路徑可能需要以`--`作為前綴,以將它們與選項或修訂范圍分開。
## 映射作者
`.mailmap`功能用于將短名中的同一個人合并到一起,其中他們的姓名和/或電子郵件地址拼寫不同。
如果文件`.mailmap`存在于存儲庫的頂層,或者位于mailmap.file或mailmap.blob配置選項所指向的位置,則它用于將作者和提交者名稱以及電子郵件地址映射到規范的真實姓名和電子郵件地址。
在簡單形式中,文件中的每一行都包含作者的規范實名,空格和提交中使用的電子郵件地址(由_<_ 和_>_ 括起來)映射到名稱。例如:
```
Proper Name <commit@email.xx>
```
更復雜的形式是:
```
<proper@email.xx> <commit@email.xx>
```
允許mailmap僅替換提交的電子郵件部分,并且:
```
Proper Name <proper@email.xx> <commit@email.xx>
```
它允許mailmap替換與指定的提交電子郵件地址匹配的提交的名稱和電子郵件,并且:
```
Proper Name <proper@email.xx> Commit Name <commit@email.xx>
```
它允許mailmap替換與指定的提交名稱和電子郵件地址匹配的提交的名稱和電子郵件。
示例1:您的歷史記錄包含兩位作者Jane和Joe的提交,其名稱以多種形式出現在存儲庫中:
```
Joe Developer <joe@example.com>
Joe R. Developer <joe@example.com>
Jane Doe <jane@example.com>
Jane Doe <jane@laptop.(none)>
Jane D. <jane@desktop.(none)>
```
現在假設Joe希望他的中間名最初使用,而Jane更喜歡她的姓氏完全拼寫出來。一個合適的`.mailmap`文件看起來像:
```
Jane Doe <jane@desktop.(none)>
Joe R. Developer <joe@example.com>
```
注意如何不需要`<jane@laptop.(none)>`的條目,因為該作者的真實姓名已經正確。
示例2:您的存儲庫包含以下作者的提交:
```
nick1 <bugs@company.xx>
nick2 <bugs@company.xx>
nick2 <nick2@company.xx>
santa <me@company.xx>
claus <me@company.xx>
CTO <cto@coompany.xx>
```
然后你可能想要一個看起來像這樣的`.mailmap`文件:
```
<cto@company.xx> <cto@coompany.xx>
Some Dude <some@dude.xx> nick1 <bugs@company.xx>
Other Author <other@author.xx> nick2 <bugs@company.xx>
Other Author <other@author.xx> <nick2@company.xx>
Santa Claus <santa.claus@northpole.xx> <me@company.xx>
```
將哈希_#_用于自己的行或電子郵件地址之后的注釋。
## GIT
部分 [git [1]](https://git-scm.com/docs/git) 套件
- git
- git-config
- git-help
- git-init
- git-clone
- git-add
- git-status
- git-diff
- git-commit
- git-reset
- git-rm
- git-mv
- git-branch
- git-checkout
- git-merge
- git-mergetool
- git-log
- git-stash
- git-tag
- git-worktree
- git-fetch
- git-pull
- git-push
- git-remote
- git-submodule
- git-show
- git-log
- git-shortlog
- git-describe
- git-apply
- git-cherry-pick
- git-rebase
- git-revert
- git-bisect
- git-blame
- git-grep
- gitattributes
- giteveryday
- gitglossary
- githooks
- gitignore
- gitmodules
- gitrevisions
- gittutorial
- gitworkflows
- git-am
- git-format-patch
- git-send-email
- git-request-pull
- git-svn
- git-fast-import
- git-clean
- git-gc
- git-fsck
- git-reflog
- git-filter-branch
- git-instaweb
- git-archive
- git-bundle
- git-daemon
- git-update-server-info
- git-cat-file
- git-check-ignore
- git-checkout-index
- git-commit-tree
- git-count-objects
- git-diff-index
- git-for-each-ref
- git-hash-object
- git-ls-files
- git-merge-base
- git-read-tree
- git-rev-list
- git-rev-parse
- git-show-ref
- git-symbolic-ref
- git-update-index
- git-update-ref
- git-verify-pack
- git-write-tree