本文へスキップ
Skillpedia
デプロイとクラウド(DevOps)280k · #185

git-workflow

できること

Git(バージョン管理システム)を使う際のベストプラクティスを解説するガイドです。コードの変更履歴の整理方法、変更内容を説明する分かりやすいメッセージの書き方、チームでの最適な作業方法を紹介します。

使う場面

  • ✓新しいプロジェクトを始めて、コードの管理方法を決めるとき。
  • ✓GitHub Flow や GitFlow などのコード管理戦略をどれにするか決めるとき。
  • ✓コードに加えた変更を説明するメッセージを書くとき。

スキルのリンク

https://github.com/affaan-m/ECC/blob/main/pi/core/skills/git-workflow/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/affaan-m/ECC/blob/main/pi/core/skills/git-workflow/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“Git Flow を使ってプロジェクトを整理するには、どうすればよいですか?”

毎週5つの新しいスキル。1分で読めます。

仕組み

GitHub Flow(シンプルで多くの場合に向いている)と GitFlow(より複雑で、計画的なリリースがあるプロジェクト向け)など、いくつかの管理モデルを紹介します。また、明確なパターンに従って 'commit' メッセージを書く方法も教えます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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:

  • main is 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 main or 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:

  • main contains production-ready code only
  • develop is the integration branch
  • Feature branches from develop, merge back to develop
  • Release branches from develop, merge to main and develop
  • Hotfix branches from main, merge to both main and develop

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

…

よくある質問

「commit」とは何ですか?

「commit」は、プロジェクトにおける「保存」のようなもので、ある時点でのコードへの一連の変更を記録することです。

「merge」と「rebase」の違いは何ですか?

「merge」は2つのブランチの履歴を統合し、いつ合流したかの記録を残します。「rebase」は、自分の変更を別のブランチの最新の変更の後に行われたように並べ直し、より一直線な履歴にします。

なぜ「Conventional Commits」を使うのですか?

各変更が何をするもの(新機能か、バグ修正かなど)かを素早く把握でき、リリースノートの作成などの作業を自動化しやすくなるからです。

詳細

作者による元の説明

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

人気

GitHubのスター
280k
ランキング
#185
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル