> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/19/appendixes/sourcerepo/git.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# I.1. 透過 Git 取得原始碼 \#

### I.1. 透過 Git 取得原始碼 [#](#git) <a href="#git" id="git"></a>

使用 Git 時，你會在本機建立整個程式碼儲存庫的副本，因此可離線存取所有歷史紀錄與分支。這是開發或測試修補程式最快且最有彈性的方式。

**Git**

1. 你需要安裝 Git，可從 <https://git-scm.com> 取得。許多系統預設已安裝較新的 Git 版本，或可在其套件發行系統中取得。
2. 若要開始使用 Git 儲存庫，請複製官方鏡像：

   ```

   git clone https://git.postgresql.org/git/postgresql.git
   ```

   這會將完整儲存庫複製到本機，因此可能需要一些時間，尤其是在網際網路連線較慢時。檔案會放在目前目錄下的新子目錄 `postgresql` 中。
3. 每當你要取得系統的最新更新時，請 `cd` 至儲存庫並執行：

   ```

   git fetch
   ```

Git 能做的不只取得原始碼。詳細資訊請參閱 Git man page，或造訪 <https://git-scm.com>。

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/git.html)（原文版本：18.6；核對日期：2026-09-10）


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.postgresql.tw/19/appendixes/sourcerepo/git.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
