diff --git a/.github/ISSUE_TEMPLATE/training.yml b/.github/ISSUE_TEMPLATE/training.yml index f09f866..ce9a28a 100644 --- a/.github/ISSUE_TEMPLATE/training.yml +++ b/.github/ISSUE_TEMPLATE/training.yml @@ -15,6 +15,10 @@ body: - 実習一覧: [exercises/](https://github.com/Lumos-Programming/github-practice/blob/main/exercises/README.md) - 困ったとき: [docs/06-troubleshooting.md](https://github.com/Lumos-Programming/github-practice/blob/main/docs/06-troubleshooting.md) + > **⚠️ 下のチェックリストだけでは進められません。** + > 各Stepの見出しの下にある 👉 **手順書を開く: `exercises/...`** のリンクが、 + > その実習の詳しい手順です。**必ずリンクを開いてから** チェックを付けてください。 + > このRepositoryでは **意図的に失敗して構いません。** > 壊し方と直し方の両方を、実際の開発Repositoryに入る前に経験してください。 @@ -52,7 +56,9 @@ body: label: 進行表 description: そのまま作成してください(編集不要です) value: | - ### Step 0. 事前準備 — [docs/03-setup.md](https://github.com/Lumos-Programming/github-practice/blob/main/docs/03-setup.md) + ### Step 0. 事前準備 + + 👉 **手順書を開く: [docs/03-setup.md](https://github.com/Lumos-Programming/github-practice/blob/main/docs/03-setup.md)** - [ ] `git --version` でGit 2.23以上を確認した - [ ] `git config --global user.name` を設定した @@ -65,7 +71,9 @@ body: - [ ] [01 Concepts](https://github.com/Lumos-Programming/github-practice/blob/main/docs/01-concepts.md) を読んだ(GitとGitHubの違い / 用語) - [ ] [02 Rules](https://github.com/Lumos-Programming/github-practice/blob/main/docs/02-rules.md) を読んだ(Lumosの基本ルール6つ) - ### Step 2. 実習1: CloneからPull Requestまで — [手順](https://github.com/Lumos-Programming/github-practice/blob/main/exercises/01-clone-to-pr.md) + ### Step 2. 実習1: CloneからPull Requestまで + + 👉 **手順書を開く: [exercises/01-clone-to-pr.md](https://github.com/Lumos-Programming/github-practice/blob/main/exercises/01-clone-to-pr.md)** - [ ] `git clone` した - [ ] `git status` / `git branch` で現在地を確認した @@ -82,7 +90,9 @@ body: - [ ] Pull Requestを作成した(テンプレートを埋めた) - [ ] CI(Training Check)が緑になった - ### Step 3. 実習2: Pull Request Review — [手順](https://github.com/Lumos-Programming/github-practice/blob/main/exercises/02-review.md) + ### Step 3. 実習2: Pull Request Review + + 👉 **手順書を開く: [exercises/02-review.md](https://github.com/Lumos-Programming/github-practice/blob/main/exercises/02-review.md)** - [ ] 他メンバーのPull RequestをFiles changedで読んだ - [ ] 行コメントを1件以上書いた @@ -93,7 +103,9 @@ body: - [ ] Remoteの作業Branchを削除した(Delete branch) - [ ] `git branch -d` で手元のBranchも削除した - ### Step 4. 実習3: PullとFetch — [手順](https://github.com/Lumos-Programming/github-practice/blob/main/exercises/03-pull-fetch.md) + ### Step 4. 実習3: PullとFetch + + 👉 **手順書を開く: [exercises/03-pull-fetch.md](https://github.com/Lumos-Programming/github-practice/blob/main/exercises/03-pull-fetch.md)** - [ ] `git fetch` の前後で `git status` の表示が変わることを確認した - [ ] `git log --oneline main..origin/main` で取り込む前に差分を見た @@ -102,20 +114,26 @@ body: - [ ] `git log --oneline --graph --all` でBranchの分岐と合流を見た - [ ] fetchとpullの違いを自分の言葉で説明できる - ### Step 5. 実習4: 変更を取り消す — [手順](https://github.com/Lumos-Programming/github-practice/blob/main/exercises/04-restore.md) + ### Step 5. 実習4: 変更を取り消す + + 👉 **手順書を開く: [exercises/04-restore.md](https://github.com/Lumos-Programming/github-practice/blob/main/exercises/04-restore.md)** - [ ] `git restore ` で編集内容が消えることを確認した - [ ] `git restore --staged ` でStagingだけ外れ、編集は残ることを確認した - [ ] 2つの違いを説明できる - ### Step 6. 実習5: Stash — [手順](https://github.com/Lumos-Programming/github-practice/blob/main/exercises/05-stash.md) + ### Step 6. 実習5: Stash + + 👉 **手順書を開く: [exercises/05-stash.md](https://github.com/Lumos-Programming/github-practice/blob/main/exercises/05-stash.md)** - [ ] `git stash` で変更を退避した - [ ] 退避中に別Branchへ移動できることを確認した - [ ] `git stash list` で一覧を見た - [ ] `git stash pop` で変更が戻ることを確認した - ### Step 7. 実習6: Conflict — [手順](https://github.com/Lumos-Programming/github-practice/blob/main/exercises/06-conflict.md) + ### Step 7. 実習6: Conflict + + 👉 **手順書を開く: [exercises/06-conflict.md](https://github.com/Lumos-Programming/github-practice/blob/main/exercises/06-conflict.md)** - [ ] Part A: `git merge origin/seed/conflict` でConflictを発生させた - [ ] `git status` を読んで、次にすべきことを自分で判断した @@ -127,7 +145,9 @@ body: - [ ] `git merge --abort` の存在を知った - [ ] (任意)Part B: ペアでPull Request経由のConflictを解消した - ### Step 8. 実習7: Commitを取り消す — [手順](https://github.com/Lumos-Programming/github-practice/blob/main/exercises/07-undo-commit.md) + ### Step 8. 実習7: Commitを取り消す + + 👉 **手順書を開く: [exercises/07-undo-commit.md](https://github.com/Lumos-Programming/github-practice/blob/main/exercises/07-undo-commit.md)** - [ ] `git revert` で打ち消しCommitが作られることを確認した - [ ] `git reset --soft HEAD~1` でCommitを取り消し、変更が残ることを確認した diff --git a/README.md b/README.md index c17d0e8..b429e3e 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,10 @@ Gitコマンドを暗記することではなく、 1. 管理者があなた専用の **Issue** を1件作成します。**そのIssueがあなたの進行表**です。 2. Issueのチェックリストを上から順に進めます。 -3. 各ステップに実習ページへのリンクがあります。用語やコマンドで詰まったら `docs/` を引きます。 -4. すべてのチェックが付いたら、Issueを **Close** して研修完了です。 +3. **各Stepの見出しの下にある 👉 のリンクが、その実習の手順書(`exercises/` 配下)です。** + チェックリストだけでは進められません。必ずリンクを開いてから進めてください。 +4. 用語やコマンドで詰まったら `docs/` を引きます。 +5. すべてのチェックが付いたら、Issueを **Close** して研修完了です。 > このリポジトリでは **意図的に失敗して構いません。** > Branchを間違える・Commitを間違える・Conflictを起こす・Commitを取り消す。 diff --git a/docs/03-setup.md b/docs/03-setup.md index 15ca925..6ba9e29 100644 --- a/docs/03-setup.md +++ b/docs/03-setup.md @@ -107,7 +107,28 @@ git config --global core.autocrlf input --- -## 7. GitHubへの認証 +## 7. Windows(PowerShell)を使う場合の注意 + +PowerShellでは `@{` が **PowerShell自身の記法** として解釈されます。 +そのため、`stash@{0}` や `HEAD@{1}` のような書き方をそのまま実行すると、 +Gitに届く前にPowerShellがエラーにします。 + +```powershell +git stash show -p stash@{0} # ❌ PowerShellではエラーになる +git stash show -p "stash@{0}" # ✅ 引用符で囲む +``` + +同じ理由で `git reset --hard "HEAD@{1}"` も引用符が必要です。 + +> 引用符を付けた書き方は macOS / Linux / Git Bash でもそのまま動きます。 +> **`@{ }` が出てきたら常に引用符で囲む** と覚えておけば安全です。 + +PowerShellの挙動で悩みたくない場合は、Git for Windows に同梱の +**Git Bash** を使うと、この資料のコマンドをそのまま実行できます。 + +--- + +## 8. GitHubへの認証 Cloneやpush時に認証を求められます。おすすめは [GitHub CLI](https://cli.github.com/) です。 diff --git a/docs/06-troubleshooting.md b/docs/06-troubleshooting.md index 3b135d0..7add328 100644 --- a/docs/06-troubleshooting.md +++ b/docs/06-troubleshooting.md @@ -88,6 +88,18 @@ git merge --abort Merge開始前の状態に戻ります。 +### PowerShellで `stash@{0}` や `HEAD@{1}` がエラーになる + +PowerShellは `@{` を自分の記法として解釈します。引用符で囲んでください。 + +```powershell +git stash show -p "stash@{0}" +git reset --hard "HEAD@{1}" +``` + +引用符を付けた形は macOS / Linux / Git Bash でもそのまま動きます。 +詳細は [03 Setup](03-setup.md#7-windowspowershellを使う場合の注意) を参照してください。 + ### 何が起きたか分からない / 作業を失ったかもしれない ```bash diff --git a/docs/99-cheatsheet.md b/docs/99-cheatsheet.md index e01b3ba..1fb6eac 100644 --- a/docs/99-cheatsheet.md +++ b/docs/99-cheatsheet.md @@ -80,6 +80,9 @@ git push -u origin feature/xxx | `git reset --soft HEAD~1` | Commitだけ取り消す(変更は残る) | | `git reset --hard HEAD~1` | Commitも変更も捨てる ⚠️⚠️ | +> Windows(PowerShell)では `stash@{0}` / `HEAD@{1}` のような `@{ }` を含む指定は +> `"stash@{0}"` のように引用符で囲んでください([03 Setup](03-setup.md#7-windowspowershellを使う場合の注意))。 + ## 一時退避 | コマンド | 意味 | diff --git a/exercises/05-stash.md b/exercises/05-stash.md index c876e1a..8501d91 100644 --- a/exercises/05-stash.md +++ b/exercises/05-stash.md @@ -116,9 +116,14 @@ stash@{0}: WIP on training/taro-stash: 8f2c1ab Add Taro training profile 中身を見ることもできます。 ```bash -git stash show -p stash@{0} +git stash show -p "stash@{0}" ``` +> ⚠️ **Windows(PowerShell)の場合は `"stash@{0}"` のように引用符で囲んでください。** +> 囲まないと `@{` がPowerShell自身の記法として解釈され、エラーになります。 +> 引用符はmacOS / Linux / Git Bash でもそのまま動くので、常に付けて構いません。 +> 詳細は [03 Setup の「Windows(PowerShell)を使う場合の注意」](../docs/03-setup.md#7-windowspowershellを使う場合の注意) を参照してください。 + --- ## Step 7: 戻す diff --git a/exercises/07-undo-commit.md b/exercises/07-undo-commit.md index 9a7b2a6..b1adeb2 100644 --- a/exercises/07-undo-commit.md +++ b/exercises/07-undo-commit.md @@ -213,10 +213,14 @@ git reflog ## Step 13: 復旧してみる ```bash -git reset --hard HEAD@{1} +git reset --hard "HEAD@{1}" git log --oneline ``` +> ⚠️ **Windows(PowerShell)の場合は `"HEAD@{1}"` のように引用符で囲んでください。** +> `stash@{0}` と同じ理由です。詳細は +> [03 Setup の「Windows(PowerShell)を使う場合の注意」](../docs/03-setup.md#7-windowspowershellを使う場合の注意) を参照してください。 + **戻ってきました。** > `reflog` はHEADが移動した履歴です。`reset --hard` で失敗しても、