このセクションで学ぶこと
Gitには独特の用語がたくさんあります。最初に覚えるべき基本用語を整理しましょう。
Gitの3つの場所
Gitでファイルを管理するとき、3つの「場所」を意識する必要があります。
graph LR
subgraph LocalPC["ローカル(自分のPC)"]
Working["作業ディレクトリ<br/>(Working)<br/>ファイルを編集"]
Staging["ステージング<br/>(Staging)<br/>変更を準備"]
Repo["リポジトリ<br/>(Repo)<br/>履歴に記録"]
end
Working -->|"add"| Staging
Staging -->|"commit"| Repo
style LocalPC fill:#f8fafc,stroke:#475569,stroke-width:2px,color:#1e293b
style Working fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af
style Staging fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#92400e
style Repo fill:#d1fae5,stroke:#059669,stroke-width:2px,color:#064e3b
基本用語一覧
操作に関する用語
| 用語 | 読み方 | 意味 |
|---|---|---|
| commit | コミット | 変更を履歴に記録すること |
| add | アド | 変更をステージングに追加すること |
| push | プッシュ | ローカルの変更をリモートに送ること |
| pull | プル | リモートの変更をローカルに取り込むこと |
| clone | クローン | リモートリポジトリを丸ごとコピーすること |
| fetch | フェッチ | リモートの情報だけ取得すること(マージはしない) |
場所に関する用語
| 用語 | 読み方 | 意味 |
|---|---|---|
| working directory | ワーキングディレクトリ | 実際にファイルを編集する場所 |
| staging area | ステージングエリア | コミット前の準備場所(インデックスとも呼ぶ) |
| repository | リポジトリ | 履歴が保存される場所 |
状態に関する用語
| 用語 | 読み方 | 意味 |
|---|---|---|
| tracked | トラックト | Gitが追跡しているファイル |
| untracked | アントラックト | Gitがまだ追跡していないファイル |
| modified | モディファイド | 変更されたが、まだステージングされていない |
| staged | ステージド | ステージングに追加され、コミット待ち |
コミット(commit)
一言で言うと
「この時点の状態を保存!」という操作
例え話
ゲームの「セーブポイント」のようなもの。コミットすると、その時点の状態に いつでも戻れます。
コマンド
git commit -m "変更内容の説明"
コミットに含まれる情報
commit a1b2c3d4e5f6...
Author: Taro Yamada <taro@example.com>
Date: Mon Jan 27 10:00:00 2026 +0900
ログイン機能を追加
- コミットID: 変更を識別するユニークな文字列
- Author: 誰がコミットしたか
- Date: いつコミットしたか
- Message: 何を変更したかの説明
ステージング(staging)
一言で言うと
「この変更をコミットに含める」と選ぶ操作
なぜ必要?
複数のファイルを変更したとき、「今回はAとBだけコミットして、Cは後で」ということができます。
例え話
スーパーの「カゴ」のようなもの。商品(変更)をカゴに入れてから、レジ(コミット)に持っていきます。
コマンド
git add ファイル名 # 特定のファイルをステージング
git add . # すべての変更をステージング
プッシュ(push)とプル(pull)
push: ローカル → リモート
git push
自分の変更をチームに共有するときに使います。
pull: リモート → ローカル
git pull
チームメンバーの変更を取り込むときに使います。
図解
graph LR
You["あなたのPC"]
GitHub["GitHub"]
Colleague["同僚のPC"]
You -->|"push"| GitHub
Colleague -->|"push"| GitHub
GitHub -->|"pull"| You
GitHub -->|"pull"| Colleague
style You fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af
style GitHub fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#92400e
style Colleague fill:#d1fae5,stroke:#059669,stroke-width:2px,color:#064e3b
クローン(clone)
一言で言うと
リモートリポジトリを丸ごとコピーする
コマンド
git clone https://github.com/someone/project.git
いつ使う?
- 新しいプロジェクトに参加するとき
- オープンソースのコードを手元で動かしたいとき
よく使うコマンドまとめ
# 状態確認
git status # 現在の状態を確認
# 基本の流れ
git add ファイル名 # 変更をステージング
git commit -m "説明" # 変更をコミット
git push # リモートに送信
git pull # リモートから取得
# 履歴確認
git log # コミット履歴を表示
git diff # 変更内容を表示
用語の関係図
graph TD
RemoteRepo["リモートリポジトリ(GitHub)"]
subgraph LocalBox["ローカルリポジトリ"]
Working["Working<br/>(作業)"]
Staging["Staging<br/>(準備)"]
Repository["Repository<br/>(履歴)"]
end
RemoteRepo -->|"clone"| LocalBox
Repository -->|"push"| RemoteRepo
RemoteRepo -->|"pull"| Working
Working -->|"add"| Staging
Staging -->|"commit"| Repository
style RemoteRepo fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af
style LocalBox fill:#f8fafc,stroke:#475569,stroke-width:2px,color:#1e293b
style Working fill:#fef3c7,stroke:#d97706,color:#92400e
style Staging fill:#fce7f3,stroke:#db2777,color:#831843
style Repository fill:#d1fae5,stroke:#059669,color:#064e3b
まとめ
| 用語 | 意味 | コマンド |
|---|---|---|
| commit | 変更を記録 | git commit |
| add | ステージングに追加 | git add |
| push | リモートに送信 | git push |
| pull | リモートから取得 | git pull |
| clone | リポジトリをコピー | git clone |
今日覚えるべきこと
- 変更は add → commit の順で記録する
- 共有は push / pull で行う
- 新規参加は clone でリポジトリをコピー
次のステップへ
Gitの基本用語は理解できましたか?
次のセクションでは、理解度チェックのクイズに挑戦します。Step 1で学んだ内容を振り返りましょう。
推定読了時間: 15分