AgentSkillsCN

git-log

显示文件或整个仓库的提交历史。返回包含哈希、作者、日期及消息的提交信息。

SKILL.md
--- frontmatter
name: git-log
description: Show commit history for a file or the entire repository. Returns commit information including hash, author, date, and message.
allowed-tools: Bash
metadata:
  category: git
  version: 1.0.0

Git Log Skill

This skill retrieves commit history for a file or the entire repository, providing detailed information about each commit.

Usage

The git-log skill retrieves commit history with optional filtering by path, author, and date range.

Parameters

ParameterTypeRequiredDefaultDescription
pathstringNo-Filter history to specific file
limitintNo10Maximum number of commits to return
sincedatetimeNo-Only show commits after this date
untildatetimeNo-Only show commits before this date
authorstringNo-Filter by author name or email

Example Usage

Get recent repository history:

code
Show the last 10 commits

Get history for a specific file:

code
Show commit history for /src/main.go

Filter by author:

code
Show commits by author "Alice"

Filter by date range:

code
Show commits from the last week

Result Format

Each commit includes:

  • Full commit hash (40 characters)
  • Short hash (7 characters)
  • Author name and email
  • Author timestamp
  • Committer name and email (if different)
  • Commit timestamp
  • Subject (first line of message)
  • Full commit message
  • Parent commit hashes
  • Files changed in the commit

Commit Information Fields

FieldDescription
hashFull 40-character commit hash
short_hashAbbreviated 7-character hash
authorCommit author name
author_emailAuthor's email address
author_timeWhen the commit was authored
committerPerson who applied the commit
committer_emailCommitter's email
commit_timeWhen commit was applied
subjectFirst line of commit message
messageFull commit message
parent_hashesParent commit references
files_changedList of files modified

Best Practices

  1. Start with a reasonable limit (10-20) for performance
  2. Use path filter to focus on specific file history
  3. Combine author and date filters for targeted searches
  4. Check for merge commits (multiple parents) when tracing changes
  5. Use short_hash for display, full hash for references