0
0
Fork 0
mirror of https://codeberg.org/forgejo/docs.git synced 2024-11-21 17:36:59 -05:00
forgejo-docs/docs/user/agit-support.md
2024-02-13 11:21:47 +00:00

3.1 KiB

title license origin_url
AGit Setup Apache-2.0 abe8fe3527/docs/content/usage/agit-support.en-us.md

Forgejo ships with limited support for AGit-Flow. It was originally introduced in Gitea 1.13.

Similarly to Gerrit, it is possible to create Pull Requests to a target repository by pushing directly to that said repository, without having to create feature branches or forks.

Creating Pull Requests

Creating a new Pull Request can be done by pushing to the branch that you are targeting followed by a specific refspec (a location identifier known to Git).

For clarity, suppose that you cloned a repository and created a new commit on top of the main branch. Here is you can create a Pull Request targeting the main branch:

git push origin HEAD:refs/for/main -o topic="topic-branch"

The topic branch can also be supplied directly in the ref:

git push origin HEAD:refs/for/main/topic-branch

It is possible to use some additional parameters, such as topic, title and description. Here's another example targeting the master branch:

git push origin HEAD:refs/for/master -o topic="topic-branch" \
  -o title="Title of the PR"
  -o description="# The PR Description
This can be **any** markdown content.\n
- [x] Ok"

Parameters

The following parameters are available:

  • HEAD: The target branch (required)
  • refs/<for|draft|for-review>/<branch>: The target PR type (required)
    • for: Create a normal PR with <branch> as the target branch
    • draft/ for-review: Currently ignored silently
  • <branch>/<session>: The target branch to open the PR (required)
  • -o <topic|title|description>: Options for the PR
    • title: The PR title. If left empty, the first line of the first new Git commit will be used instead.
    • topic: The branch name the PR should be opened for.*
    • description: The PR description
    • force-push: confirm force update the target branch

Caveats

Some caution is required when pushing new changes to an existing Pull Request that was created using AGit. Otherwise, Forgejo may not be able to associate your new changes with your existing Pull Request, resulting in the creation of a new Pull Request.

If you wish to push a second commit to a Pull Request that you previously created using AGit, you must use the same topic that you used before.

If you rebase or amend a commit that is already a part of your Pull Request, you must push it using the topic that you used before together with the force-push option.

For Gerrit users

Despite the similarites with the Gerrit workflow, AGit does not act as a drop-in replacement.

  • Submitting new changes will not create different "reviews" that can be reviewed individually. Subsequent commits will be appended to the same Pull Request.
  • Forgejo does not rely on Change-Ids.