code.gitea.io/gitea@v1.22.3/docs/content/usage/agit-support.en-us.md (about)

     1  ---
     2  date: "	2022-09-01T20:50:42+0000"
     3  title: "Agit Setup"
     4  slug: "agit-setup"
     5  sidebar_position: 12
     6  toc: false
     7  draft: false
     8  aliases:
     9    - /en-us/agit-setup
    10  menu:
    11    sidebar:
    12      parent: "usage"
    13      name: "Agit Setup"
    14      sidebar_position: 12
    15      identifier: "agit-setup"
    16  ---
    17  
    18  # Agit Setup
    19  
    20  In Gitea `1.13`, support for [agit](https://git-repo.info/en/2020/03/agit-flow-and-git-repo/) was added.
    21  **Note**: git version 2.29 or higher is required on the server side for this to work.
    22  
    23  ## Creating PRs with Agit
    24  
    25  Agit allows to create PRs while pushing code to the remote repo.
    26  This can be done by pushing to the branch followed by a specific refspec (a location identifier known to git).
    27  The following example illustrates this:
    28  
    29  ```shell
    30  git push origin HEAD:refs/for/main
    31  ```
    32  
    33  The command has the following structure:
    34  
    35  - `HEAD`: The target branch
    36  - `origin`: The target repository (not a fork!)
    37  - `HEAD`: The local branch containing the changes you are proposing
    38  - `refs/<for|draft|for-review>/<branch>`: The target PR type and configuration
    39    - `for`: Create a normal PR with `<branch>` as the target branch
    40    - `draft`/`for-review`: Currently ignored silently
    41    - `<branch>/`: The branch you want your changes to be merged into
    42  - `-o <topic|title|description>`: Options for the PR
    43    - `topic`: The topic of this change. It will become the name of the branch holding the changes waiting for review.  This is REQUIRED to trigger a pull request.
    44    - `title`: The PR title (optional but recommended), only used for topics not already having an associated PR.
    45    - `description`: The PR description (optional but recommended), only used for topics not already having an associated PR.
    46    - `force-push`: confirm force update the target branch
    47  
    48  Here's another advanced example for creating a new PR targeting `main` with `topic`, `title`, and `description`:
    49  
    50  ```shell
    51  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"
    52  ```