git-log
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGit Log - Commit & Documentation
Git Log - 提交与文档管理
Generate structured commit messages and maintain comprehensive git log documentation for the VRP toolkit project.
为VRP工具包项目生成结构化的提交信息,并维护全面的Git日志文档。
When to Use
适用场景
Use this skill when:
- Preparing to commit changes to the repository
- Reviewing git history to understand recent changes
- Maintaining the project's change documentation
- Need quick reference for common git commands
- Want to ensure consistent commit message formatting
在以下场景中使用本技能:
- 准备向代码仓库提交变更时
- 查看Git历史记录以了解近期变更时
- 维护项目的变更文档时
- 需要常用Git命令的快速参考时
- 希望确保提交信息格式一致时
Core Workflow: Commit & Log
核心工作流:提交与日志
Step 1: Analyze Changes
步骤1:分析变更
Before committing, analyze the current changes:
bash
git status
git diff --staged # If changes already staged
git diff # If changes not stagedKey questions to answer:
- What files were modified/added/deleted?
- What is the nature of changes (feature, bug fix, docs, refactor)?
- What scope is affected (e.g., architecture, setup, migration)?
提交前,先分析当前的变更:
bash
git status
git diff --staged # 若变更已暂存
git diff # 若变更未暂存需要明确的关键问题:
- 哪些文件被修改/添加/删除?
- 变更的性质是什么(功能新增、Bug修复、文档更新、代码重构)?
- 影响的范围是什么(例如:架构、配置、迁移)?
Step 2: Generate Commit Message
步骤2:生成提交信息
Based on the changes, generate a commit message following Conventional Commits format:
Format:
<type>(<scope>): <subject>Common types for this project:
- : New feature or functionality
feat - : Bug fix
fix - : Documentation changes
docs - : Code refactoring (no behavior change)
refactor - : Adding or updating tests
test - : Maintenance tasks, dependency updates
chore - : Code style changes (formatting, etc.)
style
Common scopes for this project:
- : Changes to overall architecture
architecture - : File migrations from SDR_stochastic
migration - : Project setup, installation, dependencies
setup - : ALNS algorithm changes
alns - : PDPTW problem definition
pdptw - : Data layer changes
data - : Visualization tools
visualization - : Tutorial notebooks
tutorials
Subject guidelines:
- Use imperative mood: "add" not "added" or "adds"
- First letter lowercase
- No period at end
- Keep under 50 characters if possible
Body (optional but recommended):
- Explain what changed and why
- Use bullet points for multiple changes
- Reference issues or related work
Examples:
feat(architecture): implement unified Solver interface for problem-algorithm separation
- Create VRPProblem, VRPSolution, Solver abstract base classes
- Implement ALNSSolver adapter pattern
- Update quickstart tutorial to demonstrate new interfacechore: update migration progress (9/9 files)
- Update CLAUDE.md completed tasks section
- Add migration entry to MIGRATION_LOG.md
- Update progress statistics根据变更内容,遵循Conventional Commits格式生成提交信息:
格式:
<type>(<scope>): <subject>本项目常用类型:
- : 新功能或功能增强
feat - : Bug修复
fix - : 文档变更
docs - : 代码重构(无行为变更)
refactor - : 添加或更新测试
test - : 维护任务、依赖更新
chore - : 代码样式变更(格式化等)
style
本项目常用范围:
- : 整体架构变更
architecture - : 从SDR_stochastic迁移文件
migration - : 项目配置、安装、依赖
setup - : ALNS算法变更
alns - : PDPTW问题定义
pdptw - : 数据层变更
data - : 可视化工具
visualization - : 教程笔记本
tutorials
主题编写指南:
- 使用祈使语气:用"add"而非"added"或"adds"
- 首字母小写
- 结尾不加句号
- 尽可能控制在50个字符以内
正文(可选但推荐):
- 说明变更内容及原因
- 多项变更使用项目符号列出
- 关联相关问题或工作
示例:
feat(architecture): implement unified Solver interface for problem-algorithm separation
- Create VRPProblem, VRPSolution, Solver abstract base classes
- Implement ALNSSolver adapter pattern
- Update quickstart tutorial to demonstrate new interfacechore: update migration progress (9/9 files)
- Update CLAUDE.md completed tasks section
- Add migration entry to MIGRATION_LOG.md
- Update progress statisticsStep 3: Maintain Git Log Documentation
步骤3:维护Git日志文档
After committing, update the git log documentation file ():
.claude/GIT_LOG.mdFile structure:
markdown
undefined提交完成后,更新Git日志文档文件():
.claude/GIT_LOG.md文件结构:
markdown
undefinedGit Log - VRP Toolkit Project
Git Log - VRP Toolkit Project
Comprehensive record of all commits with detailed information.
Comprehensive record of all commits with detailed information.
Recent Commits (newest first)
Recent Commits (newest first)
2026-01-01 - feat(architecture): implement unified Solver interface
2026-01-01 - feat(architecture): implement unified Solver interface
Hash: 4569fa1
Author: [Author Name]
Date: 2026-01-01 12:34:56
Changes:
- Created base.py module with abstract base classes
- Implemented adapter pattern for backward compatibility
- Updated quickstart tutorial
Files modified:
- vrp_toolkit/algorithms/base.py
- vrp_toolkit/algorithms/alns/solver.py
- tutorials/01_quickstart.ipynb
Hash: 4569fa1
Author: [Author Name]
Date: 2026-01-01 12:34:56
Changes:
- Created base.py module with abstract base classes
- Implemented adapter pattern for backward compatibility
- Updated quickstart tutorial
Files modified:
- vrp_toolkit/algorithms/base.py
- vrp_toolkit/algorithms/alns/solver.py
- tutorials/01_quickstart.ipynb
2025-12-31 - chore: update migration progress (9/9)
2025-12-31 - chore: update migration progress (9/9)
Hash: 9590014
Author: [Author Name]
Date: 2025-12-31 10:20:30
Changes:
- Updated CLAUDE.md with completed migration status
- Added final migration entry to MIGRATION_LOG.md
Files modified:
- .claude/CLAUDE.md
- .claude/MIGRATION_LOG.md
**Update process:**
1. Extract commit information: `git log -1 --pretty=format:"%H|%an|%ad|%s" --date=iso`
2. Get changed files: `git show --name-only --pretty=format:"" HEAD`
3. Format entry using template above
4. Add to top of "Recent Commits" section in `.claude/GIT_LOG.md`
5. Keep only last 20-30 commits in main section (archive older ones if needed)Hash: 9590014
Author: [Author Name]
Date: 2025-12-31 10:20:30
Changes:
- Updated CLAUDE.md with completed migration status
- Added final migration entry to MIGRATION_LOG.md
Files modified:
- .claude/CLAUDE.md
- .claude/MIGRATION_LOG.md
**更新流程:**
1. 提取提交信息:`git log -1 --pretty=format:"%H|%an|%ad|%s" --date=iso`
2. 获取变更文件:`git show --name-only --pretty=format:"" HEAD`
3. 使用上述模板格式化条目
4. 将条目添加到`.claude/GIT_LOG.md`的"Recent Commits"部分顶部
5. 主部分仅保留最近20-30条提交(必要时归档旧提交)Step 4: Execute Commit
步骤4:执行提交
Provide the user with exact commands to execute:
bash
undefined为用户提供可直接执行的命令:
bash
undefinedStage changes
暂存变更
git add [file1] [file2] ...
git add [file1] [file2] ...
Commit with generated message
使用生成的信息提交
git commit -m "feat(architecture): implement unified Solver interface
- Create VRPProblem, VRPSolution, Solver abstract base classes
- Implement ALNSSolver adapter pattern
- Update quickstart tutorial to demonstrate new interface"
git commit -m "feat(architecture): implement unified Solver interface
- Create VRPProblem, VRPSolution, Solver abstract base classes
- Implement ALNSSolver adapter pattern
- Update quickstart tutorial to demonstrate new interface"
Push to remote (if desired)
推送到远程仓库(如需)
git push
undefinedgit push
undefinedQuick Command Reference
快速命令参考
Status & Diff
状态与差异
bash
git status -s # Short status
git diff # Unstaged changes
git diff --staged # Staged changes
git diff HEAD~1 # Compare with previous commitbash
git status -s # 简洁状态显示
git diff # 未暂存的变更
git diff --staged # 已暂存的变更
git diff HEAD~1 # 与上一次提交对比Commit Operations
提交操作
bash
git commit -am "msg" # Stage tracked files and commit
git commit --amend # Amend last commit
git commit --amend --no-edit # Amend without changing messagebash
git commit -am "msg" # 暂存已跟踪文件并提交
git commit --amend # 修改上一次提交
git commit --amend --no-edit # 修改提交但保留原信息Branch Operations
分支操作
bash
git checkout -b feature-name # Create and switch branch
git switch -c feature-name # Modern equivalent
git branch -d branch-name # Delete local branchbash
git checkout -b feature-name # 创建并切换分支
git switch -c feature-name # 现代等效命令
git branch -d branch-name # 删除本地分支History & Log
历史与日志
bash
git log --oneline -10 # Last 10 commits, one line
git log --oneline --graph --all # Graphical history
git show HEAD # Show last commit detailsbash
git log --oneline -10 # 最近10条提交,单行显示
git log --oneline --graph --all # 图形化历史记录
git show HEAD # 显示上一次提交详情Undo & Reset
撤销与重置
bash
git restore --staged file.py # Unstage file
git restore file.py # Discard unstaged changes
git reset --soft HEAD~1 # Undo commit, keep changesbash
git restore --staged file.py # 取消文件暂存
git restore file.py # 丢弃未暂存的变更
git reset --soft HEAD~1 # 撤销提交,保留变更Integration with Other Skills
与其他技能的集成
update-progress: After updating CLAUDE.md and MIGRATION_LOG.md, use git-workflow to commit the documentation updates.
migrate-module: After migrating files, use git-workflow to commit the migrated code.
build-session-context: Read GIT_LOG.md to understand recent changes when starting a session.
update-task-board: Use GIT_LOG.md to track completion of development tasks.
update-progress: 更新CLAUDE.md和MIGRATION_LOG.md后,使用git-workflow提交文档更新。
migrate-module: 迁移文件后,使用git-workflow提交迁移后的代码。
build-session-context: 启动会话时读取GIT_LOG.md以了解近期变更。
update-task-board: 使用GIT_LOG.md跟踪开发任务的完成情况。
Project-Specific Patterns
项目特定模式
Migration Commits
迁移提交
bash
git add vrp_toolkit/problems/pdptw.py
git commit -m "feat(migration): migrate instance.py to pdptw.py
- Extract generic Instance class
- Add type hints and docstrings
- Create basic test suite"bash
git add vrp_toolkit/problems/pdptw.py
git commit -m "feat(migration): migrate instance.py to pdptw.py
- Extract generic Instance class
- Add type hints and docstrings
- Create basic test suite"Progress Update Commits
进度更新提交
bash
git add .claude/CLAUDE.md .claude/MIGRATION_LOG.md
git commit -m "chore: update migration progress (5/9 files)
- Mark instance.py migration as completed
- Update progress statistics
- Add detailed migration entry"bash
git add .claude/CLAUDE.md .claude/MIGRATION_LOG.md
git commit -m "chore: update migration progress (5/9 files)
- Mark instance.py migration as completed
- Update progress statistics
- Add detailed migration entry"Tutorial/Example Commits
教程/示例提交
bash
git add tutorials/01_quickstart.ipynb
git commit -m "docs: add quickstart tutorial
- Show basic instance creation
- Demonstrate ALNS solving
- Include visualization examples"bash
git add tutorials/01_quickstart.ipynb
git commit -m "docs: add quickstart tutorial
- Show basic instance creation
- Demonstrate ALNS solving
- Include visualization examples"GIT_LOG.md Maintenance
GIT_LOG.md维护
Initial Setup
初始设置
If doesn't exist, create it with the structure above.
.claude/GIT_LOG.md若不存在,使用上述结构创建该文件。
.claude/GIT_LOG.mdRegular Updates
定期更新
After each commit, update GIT_LOG.md with the new commit information.
每次提交后,使用新的提交信息更新GIT_LOG.md。
Archive Strategy
归档策略
- Keep last 20 commits in "Recent Commits" section
- Move older commits to "Archive" section at bottom
- Consider monthly archives if volume is high
- "Recent Commits"部分保留最近20条提交
- 将旧提交移至底部的"Archive"部分
- 若提交量较大,可考虑按月份归档
Automation Notes
自动化说明
When AI uses this skill, it should:
- Analyze current git changes
- Generate appropriate commit message
- Show user exact commands to execute
- After commit, update GIT_LOG.md with new entry
- Keep GIT_LOG.md organized and readable
AI使用本技能时应:
- 分析当前Git变更
- 生成合适的提交信息
- 向用户展示可直接执行的命令
- 提交完成后,在GIT_LOG.md中添加新条目
- 保持GIT_LOG.md的整洁与可读性
Troubleshooting
故障排除
Empty Commit Message
提交信息过于通用
If commit message seems generic, ask:
- What specific functionality was added/fixed?
- Which files were most significantly changed?
- What problem does this change solve?
若提交信息看起来过于笼统,询问:
- 新增/修复了哪些具体功能?
- 哪些文件的变更最为显著?
- 此变更解决了什么问题?
Multiple Change Types
包含多种变更类型
If changes include mixed types (e.g., feat and fix):
- Create separate commits if possible
- If must combine, use most significant type and explain in body
若变更包含多种类型(例如功能新增与Bug修复):
- 尽可能拆分为单独的提交
- 若必须合并,使用最主要的类型并在正文中说明
Missing GIT_LOG.md
缺少GIT_LOG.md
If file doesn't exist, create it with current commit history:
bash
undefined若文件不存在,使用当前提交历史创建:
bash
undefinedGet last 20 commits for initial log
获取最近20条提交以初始化日志
git log --oneline -20
undefinedgit log --oneline -20
undefined