0
0
mirror of https://gitea.com/gitea/docs.git synced 2025-05-11 19:12:44 +00:00
Files
appleboy dbfa0ba454 docs: add zh-tw folder (#195)
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/195
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
2025-04-04 23:28:16 +00:00

49 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
date: "2022-09-01T20:50:42+0000"
slug: "agit"
sidebar_position: 12
aliases:
- /zh-tw/agit-setup
- /agit-setup
---
# AGit
在 Gitea `1.13` 版本中,添加了對 [AGit](https://git-repo.info/en/2020/03/agit-flow-and-git-repo/) 的支援。AGit 允許用戶在沒有倉庫寫入權限的情況下直接創建拉取請求,也不需要分叉倉庫。這有助於減少重複倉庫的數量,降低不必要的磁盤使用量。
:::note
伺服器端需要 Git 版本 2.29 或更高版本才能正常運行。
:::
## 使用 AGit 創建 PR
AGit 允許在推送代碼到遠程倉庫時創建 PR合併請求
通過在推送時使用特定的 refspecgit 中已知的位置標識符),可以實現這一功能。
下面的示例說明了這一點:
```shell
git push origin HEAD:refs/for/main
```
該命令的結構如下:
- `HEAD`:目標分支
- `origin`:目標倉庫(不是分叉!)
- `HEAD`:包含您提議更改的本地分支
- `refs/<for|draft|for-review>/<branch>`:目標 PR 類型和配置
- `for`:創建一個以 `<branch>` 為目標分支的普通 PR
- `draft`/`for-review`:目前被靜默忽略
- `<branch>/`:您希望將更改合併到的分支
- `-o <topic|title|description>`PR 的選項
- `topic`:此更改的主題。它將成為等待審查的更改分支的名稱。這是觸發拉取請求所必需的。
- `title`PR 的標題(可選但建議),僅用於尚未關聯 PR 的主題。
- `description`PR 的描述(可選但建議),僅用於尚未關聯 PR 的主題。
- `force-push=true`: 是否強制更新目標分支。
- 注意: 省略值並僅使用 `-o force-push` 也可以正常工作。
下面是另一個高級示例,用於創建一個以 `topic``title``description` 為參數的新 PR目標分支是 `main`
```shell
git push origin HEAD:refs/for/main -o topic="topic_of_my_PR" -o title="Title of the PR" -o description="# The PR Description\nThis can be **any** markdown content.\n- [x] Ok"
```