Home首頁  /  Lessons課程  /  Lesson 6第六課

Git & GitHub, Decoded看懂 Git 與 GitHub 的術語

The first time Claude Code or Cursor asks "want me to commit this?" or "should I open a branch?", it can feel like the tool switched to a foreign language. It didn't — it's really just a handful of simple ideas. Once you know them, every AI coding tool makes a lot more sense.

當 Claude Code 或 Cursor 第一次問你「要不要 commit 這個?」或「要開一個 branch 嗎?」,感覺就像它突然講起外星語。其實不是——那只是幾個簡單的概念。搞懂它們之後,任何 AI 寫程式工具你都聽得懂。

What you'll be able to do你將學會

  • a Know the real difference between Git and GitHuba 分清楚 Git 和 GitHub 到底哪裡不一樣
  • b Understand what "commit" and "push" actually dob 搞懂 commit 和 push 實際上在做什麼
  • c Know what clone, pull, and branch mean when AI mentions themc AI 提到 clone、pull、branch 時知道那是什麼意思
  • d Feel confident undoing a mistake instead of panickingd 東西改壞時懂得怎麼救回來,而不是慌張
Before we start.開始之前。 Nothing to set up — this is a reading lesson. It'll help most if you've already published a site in Lesson 1, or you're using an AI coding tool like Claude Code, Cursor, or Codex. About 15 minutes. 不需要安裝任何東西——這是一堂閱讀課。如果你已經在第一課發佈過網站,或正在用 Claude Code、Cursor、Codex 之類的 AI 寫程式工具,會更有感覺。大約 15 分鐘。
Part A

Why AI keeps using these words為什麼 AI 一直在講這些詞

Every AI coding tool — Claude Code, Cursor, Codex, all of them — is built on top of Git, the same version-control system professional developers have used for 20 years. Their vocabulary leaks into your conversation. That's not a bug you did wrong; it's just what's underneath. Here's a quick preview of the six words worth knowing — we'll unpack each one below.每一個 AI 寫程式工具——Claude Code、Cursor、Codex——底層用的都是 Git,一套專業工程師用了 20 年的版本控制系統。它的詞彙自然會出現在你的對話裡。這不是你哪裡做錯了,只是底層本來就長這樣。以下先快速預覽六個值得認識的詞,下面會一一拆解。

Git

The save-and-history system itself. Runs quietly inside your AI tool.

存檔與歷史紀錄系統本身。安安靜靜在你的 AI 工具裡運作。

GitHub

The website that stores a copy of that history online — where your site lives.

把那份歷史紀錄放到線上的網站——你的網站就住在這。

Commit

A checkpoint — a saved snapshot of what just changed, with a short note.

一個檢查點——把剛剛改的東西存成快照,附一句簡短說明。

Push

Uploading your checkpoints to GitHub — this is what makes your site go live.

把你的檢查點上傳到 GitHub——網站就是這樣上線的。

Branch

A separate draft version of your site you can experiment on safely.

一個獨立的草稿版本,可以放心在上面實驗。

Pull RequestPull Request

A request to merge a branch's changes back into the live version.

請求把某個 branch 的變更合併回正式上線的版本。

This lesson was prompted by a short explainer from Gary Chen (@garytalksstuff) — worth a watch if you'd like a second explanation of the same ideas. 這堂課的靈感來自 Gary Chen (@garytalksstuff) 的一支短片——如果想聽另一種講法,值得一看。
Part B

Git vs. GitHub — they're not the same thingGit 跟 GitHub 不是同一件事

This is the single most confusing pair of words in the whole topic, because they sound like the same thing said twice. They're not.這是整個主題裡最容易搞混的一對詞,因為聽起來像同一個字講兩次。其實不是。

The analogy that sticks.一個好記的比喻。 Git is like Word's "Track Changes" plus a save-history feature — the idea of keeping every version of a document. GitHub is like Google Drive — a website where those saved versions live, so you (and GitHub Pages) can reach them from anywhere. Git is the concept; GitHub is one company's website that hosts it. (GitLab and Bitbucket are others.) Git 就像 Word 的「追蹤修訂」加上存檔歷史紀錄的概念——保留文件每一個版本的想法。GitHub 就像 Google Drive——一個放這些存檔版本的網站,讓你(還有 GitHub Pages)隨時都能拿到。Git 是概念;GitHub 是某家公司拿來裝這個概念的網站。(GitLab、Bitbucket 是另外兩家。)

In practice: your AI coding tool speaks Git on your computer (or in its own workspace) — that's where commits happen. GitHub is the destination those commits travel to when you push, and it's what actually serves your live website.實際運作上:你的 AI 工具在你的電腦(或它自己的工作空間)裡講 Git——commit 就是在那裡發生的。GitHub 則是 push 之後,這些 commit 要去的目的地,也是真正把你的網站放上線的地方。

Part C

Commit & push — save, then uploadCommit 與 push——先存檔,再上傳

These two always travel together, and they map onto something you already do all the time: saving a game, then syncing that save to the cloud.這兩個詞總是一起出現,其實對應到你早就在做的事:存遊戲進度,然後把存檔同步到雲端。

You edit a file你修改一個檔案 You (or the AI) change some text or code.你(或 AI)改了一些文字或程式碼。
Commit A checkpoint is saved, with a short note about what changed.存下一個檢查點,附一句說明改了什麼。
Push That checkpoint is uploaded to GitHub.把那個檢查點上傳到 GitHub。
Your site updates網站更新 GitHub Pages picks it up — your live link now shows the change.GitHub Pages 接收到變更——你的上線連結馬上就更新了。

What AI is really askingAI 其實在問什麼

What it says它說的話What it means它的意思
"Want me to commit this?"Should I save a checkpoint of what I just changed?要不要把我剛改的東西存成一個檢查點?
"Should I push?"Should I upload that checkpoint to GitHub so it goes live?要不要把那個檢查點上傳到 GitHub,讓它上線?
"Commit message?""Commit message?"What one-line note should I attach to this checkpoint?這個檢查點要附上哪一句說明?
Commit ≠ push.Commit 不等於 push。 A commit only exists on your own machine (or the AI's workspace) until you push it. That's why AI sometimes commits many small checkpoints, then pushes once — it's saving often, but only "publishing" when you're ready. Commit 在你 push 之前,只存在你自己的電腦(或 AI 的工作空間)裡。這就是為什麼 AI 有時候會先存好幾個小檢查點,最後才一次 push——它一直在存檔,只是要等你準備好才「發佈」。
Part D

Clone, pull & branchClone、pull 與 branch

These three come up once your site (or your AI tool) needs to talk to a copy of your project that already exists somewhere else.當你的網站(或你的 AI 工具)需要跟另一個已經存在別處的專案副本溝通時,就會用到這三個詞。

  1. Clone Making your own full copy of a GitHub repository — including its whole history — onto your computer or into your AI tool's workspace. You usually only do this once, right at the start.把一個 GitHub repository 完整複製一份——連同它所有的歷史紀錄——到你的電腦或 AI 工具的工作空間裡。通常一開始只做這一次。
  2. Pull Fetching the newest changes from GitHub down into your copy. If you (or a colleague) edited a file directly on GitHub.com, a pull brings that change back to your AI tool so everyone's working from the same version.把 GitHub 上最新的變更抓下來、更新到你的副本。如果你(或同事)直接在 GitHub.com 上改了檔案,pull 一下就能把那個變更帶回你的 AI 工具,讓大家用的是同一個版本。
  3. Branch A separate, parallel version of your site where you can try something — a redesign, a risky edit — without touching the version that's already live. The live version is usually called main. When you're happy with the branch, its changes can be merged into main.一個獨立、平行的網站版本,讓你可以試點什麼——改版、有風險的修改——而不會動到已經上線的版本。上線的版本通常叫 main。等你對這個 branch 滿意了,它的變更就可以合併回 main
Branch = a draft copy.Branch = 一份草稿。 Think of main as the printed handout you already gave your class, and a branch as the draft you're still marking up. Nobody sees the draft until you decide to hand it out too. main 想成你已經發給學生的講義,branch 則是你還在改的草稿。在你決定要發出去之前,沒有人會看到那份草稿。
Part E

Worktree & pull requests — for when you go furtherWorktree 與 pull request——當你想玩得更進階

These two are less urgent than the words above. Skip this part on a first read if you just want the basics — come back once your AI tool starts mentioning them.這兩個詞沒有上面幾個急迫。第一次讀如果只想抓基本概念可以先跳過——等你的 AI 工具開始提到它們時再回來看。

  1. Worktree A way to have two AI agents working on two different branches of the same project at the same time, each in its own folder, without them stepping on each other's files. This only matters if you're running multiple AI coding sessions in parallel — most teachers won't need it on day one.讓兩個 AI agent同時在同一個專案的兩個不同 branch 上工作,各自在自己的資料夾裡,不會互相踩到對方的檔案。這只有在你同時開好幾個 AI 工作階段平行進行時才用得到——大部分老師一開始都不需要。
  2. Pull Request (PR)Pull Request(PR) A request to merge a branch's changes back into main, with a review step in between — a chance to look over what changed before it goes live. Working solo, you might just review and click merge yourself; in a team, someone else usually looks first.請求把某個 branch 的變更合併回 main,中間會有一個檢查的步驟——在正式上線之前先看過改了什麼。自己一個人做的話,你可能自己看過就按合併;如果是團隊合作,通常會請別人先看過。
Part F

When you break something當你把東西改壞了

This is the part that matters most for peace of mind: your history is never actually gone. Because every commit is a saved checkpoint, you — or your AI tool — can always step back to one that worked.這部分最能讓你安心:你的歷史紀錄其實從來不會真的消失。因為每一個 commit 都是一個存好的檢查點,你——或你的 AI 工具——永遠可以退回到能正常運作的那一個。

Things you can just ask AI to do你可以直接請 AI 做的事

"Please revert to the last working commit."
"Can you show me the recent commit history?"
"Undo the last change and go back to before this file was touched."
The risky moment is before a commit.真正有風險的是「還沒 commit」的那段時間。 Once something is committed, it's a checkpoint you can always return to. Changes that haven't been committed yet are the ones that can actually get lost. That's why "commit early, commit often" is good advice — and why it's fair to ask AI to commit before trying anything risky, like a big redesign. 一旦東西被 commit 了,它就是一個你隨時能回去的檢查點。真正可能弄丟的,是還沒 commit 的變更。這就是為什麼「常常 commit」是個好習慣——也是為什麼在請 AI 嘗試有風險的事(例如大改版)之前,先請它 commit 一下是合理的要求。
Cheat sheet速查表

Every word, one line each每個詞,各一句話

Term術語Plain English白話說法
GitThe save-and-history system underneath your AI tool.你 AI 工具底層的存檔與歷史紀錄系統。
GitHubThe website that hosts that history online — and your live site.把那份歷史放到線上的網站——也放著你上線的網站。
CommitA saved checkpoint of what just changed.剛剛改動存下來的一個檢查點。
PushUploading your checkpoints to GitHub.把你的檢查點上傳到 GitHub。
CloneMaking your own full copy of a project, once, at the start.一開始把整個專案完整複製一份給自己。
PullFetching the newest changes down into your copy.把最新的變更抓下來、更新到你的副本。
BranchA separate draft version you can experiment on safely.一份可以放心實驗的獨立草稿版本。
WorktreeTwo AI agents working on two branches at once, in separate folders.兩個 AI agent 各在自己的資料夾,同時處理兩個 branch。
Pull RequestPull RequestA request to merge a branch back into the live version, with a review step.請求把 branch 合併回上線版本,中間有一個檢查步驟。
RevertStepping back to an earlier, working checkpoint.退回到之前一個能正常運作的檢查點。
Quick check小考

Eight questions, one page八題小考,一頁搞定

Answer every question, then check your score. This grades itself right here in your browser — nothing is saved or sent anywhere.每一題都作答完,再檢查你的分數。這個測驗就在你的瀏覽器裡自動算分——什麼都不會被存起來或傳出去。

Question 1第 1 題

What's the real difference between Git and GitHub?Git 和 GitHub 真正的差別是什麼?

Question 2第 2 題

A "commit" is best described as...「commit」最貼切的說法是……

Question 3第 3 題

Right after a commit but before a push, where does that checkpoint live?commit 之後、push 之前,那個檢查點存在哪裡?

Question 4第 4 題

What does "push" do?「push」是在做什麼?

Question 5第 5 題

You want to try a risky redesign without touching your live site. What should you ask for?你想試一個有風險的改版,但不想動到已經上線的網站。你該要求什麼?

Question 6第 6 題

"Clone" means...「clone」的意思是……

Question 7第 7 題

A Pull Request (PR) is...Pull Request(PR)是……

Question 8第 8 題

AI just broke something and you want to go back to a working version. What's true?AI 把東西改壞了,你想退回到能正常運作的版本。以下哪個是對的?

You did it — quick recap你做到了——快速回顧

  • Know the real difference between Git and GitHub分清楚 Git 和 GitHub 到底哪裡不一樣
  • Understand what commit and push actually do搞懂 commit 和 push 實際上在做什麼
  • Know what clone, pull, and branch mean知道 clone、pull、branch 是什麼意思
  • Feel confident undoing a mistake instead of panicking東西改壞時懂得怎麼救回來,而不是慌張