jpskill.com
🛠️ 開発・MCP コミュニティ 🔴 エンジニア向け 👤 エンジニア・AI開発者

🛠️ Git (Essentials + Workflows + Advanced)

Git (Essentials + Workflows + Advanced)

Gitの基本的なコマンドからチームでの作業、ブランチ戦略、トラブルからの復旧まで、バージョン管理に必要な知識を幅広くカバーし、開発効率を向上させるSkill。

⏱ 障害ポストモーテム 1日 → 1時間

📺 まず動画で見る(YouTube)

▶ 【衝撃】最強のAIエージェント「Claude Code」の最新機能・使い方・プログラミングをAIで効率化する超実践術を解説! ↗

※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。

📜 元の英語説明(参考)

Full version control coverage with essential commands, team workflows, branching strategies, and recovery techniques.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Gitの基本的なコマンドからチームでの作業、ブランチ戦略、トラブルからの復旧まで、バージョン管理に必要な知識を幅広くカバーし、開発効率を向上させるSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o git-essentials-workflows-advanced.zip https://jpskill.com/download/4862.zip && unzip -o git-essentials-workflows-advanced.zip && rm git-essentials-workflows-advanced.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/4862.zip -OutFile "$d\git-essentials-workflows-advanced.zip"; Expand-Archive "$d\git-essentials-workflows-advanced.zip" -DestinationPath $d -Force; ri "$d\git-essentials-workflows-advanced.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して git-essentials-workflows-advanced.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → git-essentials-workflows-advanced フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-18
同梱ファイル
1

💬 こう話しかけるだけ — サンプルプロンプト

  • Git (Essentials + Workflows + を使って、最小構成のサンプルコードを示して
  • Git (Essentials + Workflows + の主な使い方と注意点を教えて
  • Git (Essentials + Workflows + を既存プロジェクトに組み込む方法を教えて

これをClaude Code に貼るだけで、このSkillが自動発動します。

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

[スキル名] Git (基本 + ワークフロー + 上級)

セットアップ

初回使用時は、setup.md をお読みください。デフォルト: ベストプラクティスモード (設定不要) です。

使用場面

ユーザーは、基本的な操作から複雑なワークフローまで、Git の専門知識を必要としています。エージェントは、ブランチ、マージ、リベース、競合解決、およびチームコラボレーションパターンを扱います。

アーキテクチャ

メモリは ~/git/ にあります。構造については memory-template.md を参照してください。

~/git/
└── memory.md    # ユーザー設定 (オプション)

クイックリファレンス

トピック ファイル
必須コマンド commands.md
高度な操作 advanced.md
ブランチ戦略 branching.md
競合解決 conflicts.md
履歴と復元 history.md
チームワークフロー collaboration.md
セットアップ setup.md
メモリ memory-template.md

コアルール

  1. 共有ブランチへの強制プッシュは絶対にしない — フィーチャーブランチでのみ --force-with-lease を使用してください。
  2. 早めに、頻繁にコミットする — 小さなコミットはレビュー、元に戻す、および bisect が容易です。
  3. 意味のあるコミットメッセージを書く — 最初の行は72文字以内、命令形を使用してください。
  4. プッシュする前にプルする — マージコミットを避けるため、プッシュする前に常に git pull --rebase を実行してください。
  5. マージする前にクリーンアップするgit rebase -i を使用して fixup コミットを squash してください。

チームワークフロー

フィーチャーブランチフロー:

  1. main から git checkout -b feature/name を実行します。
  2. コミットを作成し、定期的にプッシュします。
  3. PR を開き、レビューを受けます。
  4. squash して main にマージします。
  5. フィーチャーブランチを削除します。

ホットフィックスフロー:

  1. main から git checkout -b hotfix/issue を実行します。
  2. 修正、テスト、コミットします。
  3. main および develop (存在する場合) にマージします。
  4. リリースにタグを付けます。

デイリー同期:

git fetch --all --prune
git rebase origin/main  # またはチームが好む場合は merge

コミットメッセージ

  • conventional commit 形式を使用してください: type(scope): description
  • 最初の行は72文字以内にしてください。
  • タイプ: feat, fix, docs, style, refactor, test, chore

プッシュの安全性

  • --force の代わりに git push --force-with-lease を使用してください — 他の人の作業を上書きするのを防ぎます。
  • プッシュが拒否された場合は、再試行する前に git pull --rebase を実行してください。
  • main/master ブランチへの強制プッシュは絶対にしないでください。

競合解決

  • 競合するファイルを編集した後、マーカーが残っていないことを確認してください: grep -r "<<<\|>>>\|===" .
  • マージを完了する前に、コードがビルドされることをテストしてください。
  • マージが複雑になった場合は、git merge --abort で中止し、代わりに git rebase を試してください。

ブランチの衛生

  • マージされたブランチをローカルで削除してください: git branch -d branch-name
  • リモートトラッキングをクリーンアップしてください: git fetch --prune
  • PR を作成する前に、フィーチャーブランチを最新の main にリベースしてください。
  • プッシュする前に、git rebase -i を使用して乱雑なコミットを squash してください。

安全性チェックリスト

破壊的な操作 (reset --hard, rebase, force push) の前に:

  • [ ] これは共有ブランチですか? → 履歴を書き換えないでください。
  • [ ] コミットされていない変更がありますか? → まず stash またはコミットしてください。
  • [ ] 正しいブランチにいますか? → git branch で確認してください。
  • [ ] リモートは最新ですか? → まず git fetch を実行してください。

よくある落とし穴

  • git user.email が間違っている — 重要なコミットの前に git config user.email で確認してください。
  • 空のディレクトリ — Git はそれらを追跡しません、.gitkeep を追加してください。
  • サブモジュール — 常に --recurse-submodules でクローンしてください。
  • Detached HEADgit switch - を使用して前のブランチに戻ってください。
  • プッシュが拒否された — 通常、まず git pull --rebase が必要です。
  • stash pop で競合 — Stash が消えます。代わりに stash apply を使用してください。
  • 大きなファイル — 50MBを超えるファイルには Git LFS を使用し、秘密情報をコミットしないでください。
  • 大文字と小文字の区別 — Mac/Windows は大文字と小文字を区別しませんが、Linux は区別します — CI の失敗の原因となります。

復旧コマンド

  • 変更を保持したまま最後のコミットを元に戻す: git reset --soft HEAD~1
  • ステージされていない変更を破棄する: git restore filename
  • 失われたコミットを見つける: git reflog (約90日間の履歴を保持します)
  • 削除されたブランチを復元する: git checkout -b branch-name <sha-from-reflog>
  • コミットが複数の変更を混ぜている場合、部分的なステージングには git add -p を使用してください。

Bisect を使用したデバッグ

バグを導入したコミットを見つける:

git bisect start
git bisect bad                    # 現在のコミットは壊れている
git bisect good v1.0.0            # このバージョンは動作した
# Git は中間コミットをチェックアウトし、テストしてから:
git bisect good                   # または git bisect bad
# Git が犯人を見つけるまで繰り返す
git bisect reset                  # 元のブランチに戻る

クイックサマリー

git status -sb                    # ブランチ付きの短いステータス
git log --oneline -5              # 最新の5つのコミット
git shortlog -sn                  # コミット数による貢献者
git diff --stat HEAD~5            # 最新の5つのコミットの変更概要
git branch -vv                    # トラッキング情報付きのブランチ
git stash list                    # 保留中のスタッシュ

関連スキル

ユーザーが確認した場合、clawhub install <slug> でインストールしてください:

  • gitlab — GitLab CI/CD とマージリクエスト
  • docker — コンテナ化ワークフロー
  • code — コード品質とベストプラクティス

フィードバック

  • 役に立った場合: clawhub star git
  • 最新情報を入手: clawhub sync
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Setup

On first use, read setup.md. Default: best practices mode (no config needed).

When to Use

User needs Git expertise — from basic operations to complex workflows. Agent handles branching, merging, rebasing, conflict resolution, and team collaboration patterns.

Architecture

Memory in ~/git/. See memory-template.md for structure.

~/git/
└── memory.md    # User preferences (optional)

Quick Reference

Topic File
Essential commands commands.md
Advanced operations advanced.md
Branch strategies branching.md
Conflict resolution conflicts.md
History and recovery history.md
Team workflows collaboration.md
Setup setup.md
Memory memory-template.md

Core Rules

  1. Never force push to shared branches — Use --force-with-lease on feature branches only
  2. Commit early, commit often — Small commits are easier to review, revert, and bisect
  3. Write meaningful commit messages — First line under 72 chars, imperative mood
  4. Pull before push — Always git pull --rebase before pushing to avoid merge commits
  5. Clean up before merging — Use git rebase -i to squash fixup commits

Team Workflows

Feature Branch Flow:

  1. git checkout -b feature/name from main
  2. Make commits, push regularly
  3. Open PR, get review
  4. Squash and merge to main
  5. Delete feature branch

Hotfix Flow:

  1. git checkout -b hotfix/issue from main
  2. Fix, test, commit
  3. Merge to main AND develop (if exists)
  4. Tag the release

Daily Sync:

git fetch --all --prune
git rebase origin/main  # or merge if team prefers

Commit Messages

  • Use conventional commit format: type(scope): description
  • Keep first line under 72 characters
  • Types: feat, fix, docs, style, refactor, test, chore

Push Safety

  • Use git push --force-with-lease instead of --force — prevents overwriting others' work
  • If push rejected, run git pull --rebase before retrying
  • Never force push to main/master branch

Conflict Resolution

  • After editing conflicted files, verify no markers remain: grep -r "<<<\|>>>\|===" .
  • Test that code builds before completing merge
  • If merge becomes complex, abort with git merge --abort and try git rebase instead

Branch Hygiene

  • Delete merged branches locally: git branch -d branch-name
  • Clean remote tracking: git fetch --prune
  • Before creating PR, rebase feature branch onto latest main
  • Use git rebase -i to squash messy commits before pushing

Safety Checklist

Before destructive operations (reset --hard, rebase, force push):

  • [ ] Is this a shared branch? → Don't rewrite history
  • [ ] Do I have uncommitted changes? → Stash or commit first
  • [ ] Am I on the right branch? → git branch to verify
  • [ ] Is remote up to date? → git fetch first

Common Traps

  • git user.email wrong — Verify with git config user.email before important commits
  • Empty directories — Git doesn't track them, add .gitkeep
  • Submodules — Always clone with --recurse-submodules
  • Detached HEAD — Use git switch - to return to previous branch
  • Push rejected — Usually needs git pull --rebase first
  • stash pop on conflict — Stash disappears. Use stash apply instead
  • Large files — Use Git LFS for files >50MB, never commit secrets
  • Case sensitivity — Mac/Windows ignore case, Linux doesn't — causes CI failures

Recovery Commands

  • Undo last commit keeping changes: git reset --soft HEAD~1
  • Discard unstaged changes: git restore filename
  • Find lost commits: git reflog (keeps ~90 days of history)
  • Recover deleted branch: git checkout -b branch-name <sha-from-reflog>
  • Use git add -p for partial staging when commit mixes multiple changes

Debugging with Bisect

Find the commit that introduced a bug:

git bisect start
git bisect bad                    # current commit is broken
git bisect good v1.0.0            # this version worked
# Git checks out middle commit, test it, then:
git bisect good                   # or git bisect bad
# Repeat until Git finds the culprit
git bisect reset                  # return to original branch

Quick Summary

git status -sb                    # short status with branch
git log --oneline -5              # last 5 commits
git shortlog -sn                  # contributors by commit count
git diff --stat HEAD~5            # changes summary last 5 commits
git branch -vv                    # branches with tracking info
git stash list                    # pending stashes

Related Skills

Install with clawhub install <slug> if user confirms:

  • gitlab — GitLab CI/CD and merge requests
  • docker — Containerization workflows
  • code — Code quality and best practices

Feedback

  • If useful: clawhub star git
  • Stay updated: clawhub sync