← W1 | 作業

練習作業

請建立至少兩個 GitHub repo,完成以下兩項作業。繳交時請附上對應的連結。

1

Pull Request 練習

在你的 repo 上完成一次完整的 feature branch → Pull Request → merge 流程。依照以下步驟操作:

Step 1:建立 repo 並推上 GitHub

$mkdir hw-pr-practice
$cd hw-pr-practice
$git init
$echo "# PR Practice" > README.md
$git add README.md
$git commit -m "Initial commit"

# 在 GitHub 建立 repo 後
$git remote add origin git@github.com:你的帳號/hw-pr-practice.git
$git push -u origin main

Step 2:開 feature branch 並做修改

$git checkout -b feature/add-profile

# 第一次 commit
$echo "# About Me" > PROFILE.md
$git add PROFILE.md
$git commit -m "Add PROFILE page"

# 第二次 commit
$echo "Student at NYCU, learning AI Agent development." >> PROFILE.md
$git add PROFILE.md
$git commit -m "Add bio to PROFILE"

Step 3:推送並發 Pull Request

$git push -u origin feature/add-profile

然後到 GitHub repo 頁面:

  1. 點 Compare & pull request
  2. 填寫 PR 標題(例:Add profile page)
  3. 在描述中說明做了什麼、為什麼
  4. 點 Create pull request

Step 4:Review 並 Merge

  1. 點 Files changed 查看 diff
  2. 確認沒問題,點 Merge pull request → Confirm merge

Step 5:同步本機

$git checkout main
$git pull origin main

繳交內容

  • 1. Repo 連結(例:https://github.com/你的帳號/hw-pr-practice)
  • 2. Pull Request 連結(例:https://github.com/.../pull/1)
2

Issue 練習

在你的 repo 上練習寫 GitHub Issue。可以用作業一的 repo,也可以另開一個。

Step 1:開第一個 Issue(Bug 回報)

到 GitHub repo 頁面:

  1. 點 Issues 分頁 → New issue
  2. 標題填一個假想的 bug,例如 README 缺少安裝說明
  3. 內容描述問題:什麼情況下發生、預期行為是什麼
  4. 右邊 Labels 選 bug
  5. 點 Submit new issue

Step 2:開第二個 Issue(功能提案)

  1. 再點 New issue
  2. 標題填一個功能需求,例如 新增 CONTRIBUTING.md 貢獻指南
  3. 內容描述你想加什麼功能、為什麼需要
  4. Labels 選 enhancement
  5. 點 Submit new issue

(加分)用 CLI 開 Issue

如果你安裝了 GitHub CLI(brew install gh),也可以用命令列操作:

# 登入 GitHub CLI
$gh auth login

# 用 CLI 開 issue
$gh issue create --title "新增 LICENSE 檔案" --body "目前 repo 缺少授權聲明,建議加上 MIT License。" --label "documentation"

# 查看所有 issue
$gh issue list

繳交內容

  • 1. Repo 連結
  • 2. 兩個 Issue 的連結(例:https://github.com/.../issues/1)