git-workflows について
git-workflows は、Git と GitHub の日常的な共同作業を支援するスキルです。コミット、ブランチ、プルリクエスト、Issue、競合解決を扱い、通常は git と gh を直接使い、Issue 起点の worktree 操作に gw を使います。
主な機能
- 01状態・差分・履歴の確認
- 02コミット、push、pull、ブランチ管理
- 03GitHub Issue と PR の作成・処理
- 04規約に沿ったコミットメッセージ作成
- 05gw による Issue worktree 管理
- 06マージ競合の解決と変更の取り消し
活用シーン
- 01コードをコミットして機能ブランチを push
- 02GitHub PR の作成やレビュー
- 03worktree を使った Issue の並行作業
- 04差分の確認とマージ競合の解決
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ autumnsgrove/ lattice --skill git-workflowsインストール後、Claude Code で/git-workflowsを入力して読み込まれたか確認します。
詳細
Git と GitHub のワークフロー
生の git および gh コマンドを直接使用します。gw が扱うのは、課題に関連するワークツリー(gw git worktree create/finish)のみです。
使用するタイミング
- Git のコミット、プッシュ、プル、ブランチの作成
- プルリクエストの作成またはレビュー
- GitHub の課題への対応
- Git の履歴、差分、または blame の確認
- マージコンフリクトの解決
- 課題対応のためのワークツリーの管理
Conventional Commits の形式
<type>(<optional scope>): <brief description>
<optional body>
<optional footer>
タイプ
| タイプ | 用途 | 例 |
|---|---|---|
feat | 新機能 | feat(auth): add OAuth refresh |
fix | バグ修正 | fix(landing): correct hero sizing |
docs | ドキュメント | docs: update API reference |
refactor | コードの再構成 | refactor(engine): extract validation |
test | テスト | test(billing): add webhook tests |
chore | メンテナンス | chore: update dependencies |
perf | パフォーマンス | perf(queries): add index for lookups |
スコープ
パッケージ名を使用します:engine、landing、plant、aspen、heartwood、prism、foliage、lumen、billing
日常のワークフロー
# Check state
git status
git diff --stat
# Stage and commit
git add .
git commit -m "feat(engine): add GlassCard hover animation"
# Push
git push
# Create PR
gh pr create --title "feat(engine): add GlassCard hover animation" --body "..."
読み取り操作
git status # Working tree status
git diff # Unstaged changes
git diff --staged # Staged changes
git diff main...HEAD # Changes on this branch vs main
git log --oneline -20 # Recent commits
git log --stat -5 # Commits with file stats
git blame src/lib/file.ts # Line-by-line authorship
git show abc123 # Show commit details
書き込み操作
git add . # Stage all
git add src/lib/specific-file.ts # Stage specific file
git commit -m "feat: add new feature" # Commit
git push # Push to remote
git push -u origin feature/new-thing # Push new branch
git pull --rebase # Pull with rebase
git branch feature/new-thing # Create branch
git switch feature/new-thing # Switch branches
git stash # Stash changes
git stash pop # Pop stash
git restore --staged file.ts # Unstage files
ワークツリー(gw 経由)
課題に関連するワークツリーは、生の git に対して gw が追加する唯一の機能です。
# Create worktree for an issue (fetches title, generates branch name)
gw git worktree create 1234 --write
# Finish: commit, push, merge into main, remove worktree
gw git worktree finish --write
# Finish with custom message
gw git worktree finish --write -m "feat: implement dark mode"
# Finish without merging (just commit + push + remove)
gw git worktree finish --write --no-merge
# List worktrees (raw git)
git worktree list
GitHub の操作
# Issues (via gw for browse TUI, or raw gh)
gw gh issue list # TUI browse with skills
gh issue create --title "..." --body "..." # Create issue
gh issue close 123 # Close issue
# Pull Requests
gh pr create --title "feat: ..." --body "..."
gh pr list
gh pr view 123
gh pr merge 123
# CI/Workflow runs
gh run list
gh run view 12345
ブランチ運用
# Feature branch workflow
git switch -c feature/user-auth
# ... work ...
git add . && git commit -m "feat(auth): implement JWT"
git push -u origin feature/user-auth
gh pr create
# Branch naming
feature/feature-name # New features
fix/bug-description # Bug fixes
refactor/what-changed # Refactors
マージコンフリクト
# Identify conflicts
git status # Shows conflicted files
# Resolve manually, then:
git add resolved-file.ts
git commit -m "fix: resolve merge conflicts"
# Or accept one side
git checkout --ours file.ts # Keep current branch version
git checkout --theirs file.ts # Keep incoming version
取り消し
git restore file.ts # Discard working changes
git restore --staged file.ts # Unstage
git reset --soft HEAD~1 # Undo commit, keep changes staged
git reset HEAD~1 # Undo commit, keep changes unstaged
git revert abc123 # Create new commit undoing a change
ベストプラクティス
推奨事項:
- 1 つのコミットにつき、論理的な変更を 1 つにする
- 50 文字未満の説明的な件名を付ける
- 命令形を使う(「Added」ではなく「Add」)
- フッターで課題を参照する(
Fixes #123) - 複数の課題を並行して進める場合はワークツリーを使用する
禁止事項:
- main/master への強制プッシュはしない
- シークレット、.env ファイル、API キーをコミットしない
- 関連のない変更を 1 つのコミットにまとめない
- あいまいなメッセージ(「fix stuff」「update」)を使わない
コメント
Markdown 対応