Agentic Research

Git (version control)

Also: 版本控制 · version control · git 是什麼 · VCS

A tool that records how a folder changes over time: who changed what, when — and lets you go back at any point.

When you will meet it

An AI agent edits your files directly. Without git, a bad edit is unrecoverable and you are reconstructing from memory; with git you can let it experiment freely and roll back with one command. This is the precondition for daring to let an AI act, and it matters far more than which model you pick.

An analogy

Like a game's save system, except it saves your code and every save records a reason. You can reload any save, and you can run several parallel storylines that each save independently.

Minimal example

git init                      # 把目前這個資料夾變成一個 repo
git add note.txt              # 把這個檔案現在的樣子放進「待存檔區」
git commit -m "第一版"         # 真的存檔,並寫下理由
git log --oneline             # 列出所有存檔
git restore note.txt          # 放棄還沒 commit 的修改,退回上一個存檔

add and commit are two separate actions: add only puts things in the basket, commit actually saves. The most common beginner question — 'why was my change not saved?' — is usually a forgotten add.

What people get wrong

  • Treating git as a backup service. Commits live on your own machine; unless you push to a remote such as GitHub, a dead disk takes the history with it.
  • Confusing git with GitHub. git is a program installed on your computer; GitHub is a website that hosts repos, and GitLab or Gitea are alternatives of the same kind.

Related terms

Next