YouTip LogoYouTip

Git Shortlog

# git shortlog command [![Image 3: Git Basic Operations](#)Git Basic Operations](#) * * * The `git shortlog` command is used to generate a concise summary of commit logs, categorized by author and commit message. The `git shortlog` command is primarily used to summarize the commit history of a Git repository, providing an overview of the commit count per author and each commit category. ### Basic Syntax git shortlog [] [] * **``**: Specifies the range of commits to generate the summary for, defaults to all commits on the current branch. * **``**: Options used to customize the output format or behavior. **Common options and usage:** | **Option** | **Description** | **Usage Example** | | --- | --- | --- | | `-n` or `--numbered` | Sort authors by the number of commits, showing the commit count for each author. | `git shortlog -n` | | `-s` or `--summary` | Only show the author and their commit count, without displaying commit messages. | `git shortlog -s` | | `-e` or `--email` | Show the author's email address. | `git shortlog -e` | | `-c` or `--committer` | Count commits by committer, not by author. | `git shortlog -GeekTimec` | | `-a` or `--all` | Include all authors (including those with no commits). | `git shortlog -a` | | `--no-merges` | Exclude merge commits, only show summaries for non-merge commits. | `git shortlog --no-merges` | | `--pretty` | Customize the output format. | `git shortlog --pretty=format:"%h %s"` | | `--since` | Only show commits within the specified time range. | `git shortlog --since="2023-01-01"` | | `--until` | Only show commits before the specified time. | `git shortlog --until="2023-01-01"` | | `--reverse` | Display the commit summary in reverse order, sorted by author commit count in ascending order. | `git shortlog --reverse` | ### Common Usage **1. Display commit authors and commit count** Sort authors by commit count, showing each author's commit count and the prefix of their commit messages: git shortlog -n **2. Display commit count per author** Only show the author and their commit count, without commit messages: git shortlog -s **3. Display author summary including email** Show the author and their email address: git shortlog -e **4. Exclude merge commits** Exclude merge commits, only show summaries for non-merge commits: git shortlog --no-merges **5. Count by committer** Count commits by committer, not by author: git shortlog -c **6. Display commits within a specific time range** Only show commit summaries within the specified time range: git shortlog --since="2023-01-01" --until="2023-06-30" **7. Custom output format** Customize the output format to show commit hash and commit message: git shortlog --pretty=format:"%h %s" * * Git Basic Operations](#)
← Git GitcodeGit Difftool β†’