Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)40k · #7222

git-commit

Skill này làm gì

Công cụ này giúp bạn tạo các thông điệp “commit” có tổ chức và theo chuẩn cho code. Nó phân tích các thay đổi bạn đã làm và gợi ý mô tả rõ ràng về những gì đã thay đổi, giúp dễ theo dõi lịch sử dự án.

Khi nào nên dùng

  • ✓Khi bạn đã hoàn tất một số thay đổi code và muốn lưu lại.
  • ✓Khi bạn muốn mô tả rõ ràng những gì đã thay đổi cho bản thân và người khác.
  • ✓Khi bạn muốn theo một cách chuẩn để ghi lại các cập nhật dự án.

Liên kết skill

https://github.com/github/awesome-copilot/blob/main/skills/git-commit/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/github/awesome-copilot/blob/main/skills/git-commit/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi muốn lưu các thay đổi code của mình.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ xem sự khác biệt giữa những gì bạn đã thay đổi và những gì đã được lưu trước đó. Dựa trên đó, nó gợi ý loại thay đổi (như “fix” hoặc “feature”) và viết một mô tả ngắn về những gì đã làm.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Git Commit with Conventional Commits

Overview

Create standardized, semantic git commits using the Conventional Commits specification. Analyze the actual diff to determine appropriate type, scope, and message.

Conventional Commit Format

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

Commit Types

Type Purpose
feat New feature
fix Bug fix
docs Documentation only
style Formatting/style (no logic)
refactor Code refactor (no feature/fix)
perf Performance improvement
test Add/update tests
build Build system/dependencies
ci CI/config changes
chore Maintenance/misc
revert Revert commit

Breaking Changes

# Exclamation mark after type/scope
feat!: remove deprecated endpoint

# BREAKING CHANGE footer
feat: allow config to extend other configs

BREAKING CHANGE: `extends` key behavior changed

Workflow

1. Analyze Diff

# If files are staged, use staged diff
git diff --staged

# If nothing staged, use working tree diff
git diff

# Also check status
git status --porcelain

2. Stage Files (if needed)

If nothing is staged or you want to group changes differently:

# Stage specific files
git add path/to/file1 path/to/file2

# Stage by pattern
git add *.test.*
git add src/components/*

# Interactive staging
git add -p

Never commit secrets (.env, credentials.json, private keys).

3. Generate Commit Message

Analyze the diff to determine:

  • Type: What kind of change is this?
  • Scope: What area/module is affected?
  • Description: One-line summary of what changed (present tense, imperative mood, <72 chars)

4. Execute Commit

# Single line
git commit -m "<type>[scope]: <description>"

# Multi-line with body/footer
git commit -m "$(cat <<'EOF'
<type>[scope]: <description>

<optional body>

<optional footer>
EOF
)"

Best Practices

  • One logical change per commit
  • Present tense: "add" not "added"
  • Imperative mood: "fix bug" not "fixes bug"
  • Reference issues: Closes #123, Refs #456
  • Keep description under 72 characters

Git Safety Protocol

  • NEVER update git config
  • NEVER run destructive commands (--force, hard reset) without explicit request
  • NEVER skip hooks (--no-verify) unless user asks
  • NEVER force push to main/master
  • If commit fails due to hooks, fix and create NEW commit (don't amend)
Câu hỏi thường gặp

“Commit” là gì?

“Commit” giống như một điểm lưu trong dự án code. Nó ghi lại một tập hợp thay đổi bạn đã làm, cùng với một thông điệp giải thích điều gì đã được sửa.

“Conventional commit messages” là gì?

Đó là cách viết thông điệp commit theo chuẩn, để chúng dễ hiểu và có thể được các công cụ khác dùng để sắp xếp lịch sử dự án.

Công cụ có tự chọn file để đưa vào commit không?

Có. Nó có thể giúp chọn các file đã thay đổi và sẵn sàng để đưa vào commit, nhưng bạn nên xem lại trước khi xác nhận.

Chi tiết

Mô tả gốc của tác giả

Execute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file stagin

repo: github/awesome-copilot

Độ phổ biến

Sao GitHub
40k
Vị trí xếp hạng
#7222
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự