git-workflow
Skill này làm gì
Hướng dẫn này dạy các thực hành tốt nhất khi dùng Git, một hệ thống quản lý phiên bản. Nó giải thích cách tổ chức lịch sử code, viết thông điệp rõ ràng cho các thay đổi và chọn cách làm việc nhóm phù hợp nhất.
Khi nào nên dùng
- ✓Khi bắt đầu một dự án mới và xác định cách quản lý code.
- ✓Khi quyết định chiến lược tổ chức code nào (như GitHub Flow hay GitFlow) để dùng.
- ✓Khi viết thông điệp để mô tả các thay đổi trong code.
Liên kết skill
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/git-workflow/SKILL.mdSao 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
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Làm sao để tổ chức dự án của tôi bằng Git Flow?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Nó đưa ra các mô hình tổ chức khác nhau, như GitHub Flow (đơn giản và phù hợp với đa số trường hợp) và GitFlow (phức tạp hơn, dành cho dự án có kế hoạch phát hành). Nó cũng chỉ cách viết thông điệp 'commit' theo một mẫu rõ ràng.
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 Workflow Patterns
Best practices for Git version control, branching strategies, and collaborative development.
When to Activate
- Setting up Git workflow for a new project
- Deciding on branching strategy (GitFlow, trunk-based, GitHub flow)
- Writing commit messages and PR descriptions
- Resolving merge conflicts
- Managing releases and version tags
- Onboarding new team members to Git practices
Branching Strategies
GitHub Flow (Simple, Recommended for Most)
Best for continuous deployment and small-to-medium teams.
main (protected, always deployable)
│
├── feature/user-auth → PR → merge to main
├── feature/payment-flow → PR → merge to main
└── fix/login-bug → PR → merge to main
Rules:
mainis always deployable- Create feature branches from
main - Open Pull Request when ready for review
- After approval and CI passes, merge to
main - Deploy immediately after merge
Trunk-Based Development (High-Velocity Teams)
Best for teams with strong CI/CD and feature flags.
main (trunk)
│
├── short-lived feature (1-2 days max)
├── short-lived feature
└── short-lived feature
Rules:
- Everyone commits to
mainor very short-lived branches - Feature flags hide incomplete work
- CI must pass before merge
- Deploy multiple times per day
GitFlow (Complex, Release-Cycle Driven)
Best for scheduled releases and enterprise projects.
main (production releases)
│
└── develop (integration branch)
│
├── feature/user-auth
├── feature/payment
│
├── release/1.0.0 → merge to main and develop
│
└── hotfix/critical → merge to main and develop
Rules:
maincontains production-ready code onlydevelopis the integration branch- Feature branches from
develop, merge back todevelop - Release branches from
develop, merge tomainanddevelop - Hotfix branches from
main, merge to bothmainanddevelop
When to Use Which
| Strategy | Team Size | Release Cadence | Best For |
|---|---|---|---|
| GitHub Flow | Any | Continuous | SaaS, web apps, startups |
| Trunk-Based | 5+ experienced | Multiple/day | High-velocity teams, feature flags |
| GitFlow | 10+ | Scheduled | Enterprise, regulated industries |
Commit Messages
Conventional Commits Format
<type>(<scope>): <subject>
[optional body]
[optional footer(s)]
Types
| Type | Use For | Example |
|---|---|---|
feat |
New feature | feat(auth): add OAuth2 login |
fix |
Bug fix | fix(api): handle null response in user endpoint |
docs |
Documentation | docs(readme): update installation instructions |
style |
Formatting, no code change | style: fix indentation in login component |
refactor |
Code refactoring | refactor(db): extract connection pool to module |
test |
Adding/updating tests | test(auth): add unit tests for token validation |
chore |
Maintenance tasks | chore(deps): update dependencies |
perf |
Performance improvement | perf(query): add index to users table |
ci |
CI/CD changes | ci: add PostgreSQL service to test workflow |
revert |
Revert previous commit | revert: revert "feat(auth): add OAuth2 login" |
Good vs Bad Examples
# BAD: Vague, no context
git commit -m "fixed stuff"
git commit -m "updates"
git commit -m "WIP"
# GOOD: Clear, specific, explains why
git commit -m "fix(api): retry requests on 503 Service Unavailable
The external API occasionally returns 503 errors during peak hours.
Added exponential backoff retry logic with max 3 attempts.
Closes #123"
Commit Message Template
Create .gitmessage in repo root:
# <type>(<scope>): <subject>
# # Types: feat, fix, docs, style, refactor, test, chore, perf, ci, revert
# Scope: api, ui, db, auth, etc.
# Subject: imperative mood, no period, max 50 chars
#
# [optional body] - explain why, not what
# [optional footer] - Breaking changes, closes #issue
Enable with: git config commit.template .gitmessage
Merge vs Rebase
Merge (Preserves History)
# Creates a merge commit
git checkout main
git merge feature/user-auth
# Result:
# * merge commit
# |\
# | * feature commits
# |/
# * main commits
Use when:
- Merging feature branches into
main - You want to preserve exact history
- Multiple people worked on the branch
…
Câu hỏi thường gặp
'Commit' là gì?
'Commit' giống như thao tác 'lưu' trong dự án, ghi lại một tập hợp thay đổi trong code tại một thời điểm cụ thể.
Khác nhau giữa 'merge' và 'rebase' là gì?
'Merge' gộp lịch sử của hai nhánh và tạo bản ghi về thời điểm chúng được gộp lại. 'Rebase' sắp xếp lại các thay đổi của bạn để chúng trông như được thực hiện sau các thay đổi mới nhất từ nhánh khác, tạo lịch sử tuyến tính hơn.
Tại sao dùng 'Conventional Commits'?
Nó giúp nhanh chóng hiểu mỗi thay đổi làm gì (là tính năng mới, sửa lỗi, v.v.) và giúp tự động hóa các việc như tạo ghi chú phát hành.
Chi tiết
Mô tả gốc của tác giả
Git workflow patterns including branching strategies, commit conventions, keeping history clean and readable, tidying local commits before merging, merge vs rebase, conflict resolution, and collaborative development best practices for teams of all sizes. Use when choosing a branching strategy, writing commit conventions, cleaning up history before a pull request, deciding merge versus rebase, or r
repo: affaan-m/ECC
Độ phổ biến
- Sao GitHub
- 280k
- Vị trí xếp hạng
- #185
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
accessibility
280kGiúp agent của bạn tạo giao diện mà ai cũng dùng được, đảm bảo website và app hoạt động tốt với người khuyết tật như người mù hoặc khó vận động.
agent-architecture-audit
280kGiúp agent của bạn kiểm tra xem mọi thứ có hoạt động đúng không, đồng thời tìm và sửa các lỗi trong hệ thống AI để chúng chạy như mong đợi.
agent-eval
280kGiúp agent của bạn so sánh các công cụ lập trình AI khác nhau, đo xem công cụ nào nhanh hơn, rẻ hơn và đáng tin cậy hơn cho từng tác vụ.
agent-harness-construction
280kGiúp agent của bạn hiểu rõ hơn cách thực hiện tác vụ, tối ưu các công cụ và chỉ dẫn mà agent dùng để tăng khả năng thành công.
Skill tương tự
openclaw-update
394kGiúp agent của bạn cập nhật OpenClaw Gateway đang có, chọn cách cập nhật phù hợp với cách cài đặt và giữ phiên làm việc của bạn hoạt động.
diagnose-gateway
394kGiúp agent của bạn tìm hiểu vì sao OpenClaw Gateway bị lỗi bằng cách kiểm tra cài đặt, kênh và cổng mà không thay đổi gì.
crabbox-apps
394kGiúp agent của bạn mở và chạy một app trên máy đám mây tạm thời, rồi hiển thị giao diện của nó trong thanh bên của chat.