forgejo-contrib-forgejo-cli-wiki-prs.md
Watch20
Star402
Fork
You've already forked forgejo-cli
CodeIssues 44Pull requests 8Releases 11Packages 2WikiActivity
Page: PRs
ActionsAuthenticationBuildingHomeInstallationIssuesOrganizationsPRsRepositoriesUsers
HTTPS
No results
9 PRs Fluffinity edited this page 2026-06-20 13:16:22 +02:00
#Table of Contents
Pull request IDs follow the same format as Issue IDs, except in many cases they can be omitted when the current branch is tracking a PR.
Pull requests are created using fj pr create. The title of the PR is taken as a positional argument, and the body can be provided as an argument with the --body flag, read from a file with the --body-from-file flag, or your $EDITOR will be opened for you to write it if neither of those flags are set.
Pull request templates work the same way issue templates do, except there is no --template flag as repositories can only have one pull request template.
By default, the base branch will be the primary branch of the repo, and the head will be the local branch's remote tracking branch. These can be overridden with the --base and --head flags. If the base is prefixed with ^ and your repository is a fork the PR will be filed against the upstream repo.
If you'd rather create the PR in the browser, you can use fj pr create --web to open the comparison page.
Normally, you have to git push your commits before you can create a pull request. If you don't want to, or cannot, create a fork, the --agit flag is available. It functions as a wrapper around Forgejo's AGit support, creating the pull request directly from your local commits.
The --autofill flag will automatically populate the title and body of the pull request from your commits, like the web UI. If only as single commit is present, the commit's summary line and body text will be used for the title and body, respectively. If there are multiple commits, the PR's title will be the name of your branch, and the body will include the messages of every included commit.
The title and body can still be provided as command line arguments, which will take precedence over the automatic contents.
Standard workflow
git switch -c feature-branch
git commit -m "Example pr!"
# The --set-upstream is required if that branch doesn't already exist in the remote
git push --set-upstream origin feature-branch
fj pr create "This is a PR!"
Filing a PR against upstream
git switch -c feature-branch
git commit -m "Example pr!"
# The --set-upstream is required if that branch doesn't already exist in the remote
git push --set-upstream origin feature-branch
fj pr create --base ^ "This is a PR for upstream"
AGit workflow
git switch -c feature-branch
git commit -m "A new feature"
fj pr create "Add a new feature" --agit
--agit and --autofill are compatible.
git switch -c update-dep
git commit -m "chore: update `foo` dependency"
fj pr create -aA # this is short for "--autofill --agit"
fj pr edit is largely the same as fj issue edit, except for edit labels. Add a label with the --add flag and remove with the --remove flag
Examples:
fj pr edit labels \
--add "Priority/High" \
--add "Release Blocker" \
--remove "Priority/Medium"
fj pr view displays the text body, title, changed lines, etc. of a pull request.
fj pr status displays the mergeability and CI status of a pull request. Use the --wait flag to only exit once every check has completed.
fj pr checkout checks out a pull request in a new local branch. The ID is required in this case. Prefix the ID with ^ to access a PR from the parent repo.
Examples:
fj pr view forgejo-contrib/forgejo-cli#42
fj pr browse codeberg.org/forgejo-contrib/forgejo-cli#42
fj pr checkout ^16
The fj pr comment and fj pr edit comment commands are the same as the corresponding issue commands. See the issues page for more.
Merge a PR with fj pr merge. Uses the repo's main merge style by default, but that can be changed with the --method flag. If a commit title and message are needed, they can be set with the --title and --message flags. Set --delete to delete the PR's remote branch.
fj pr close is the same as fj issue close.
Examples:
fj pr merge --delete --method rebase
fj pr close 42 --with-msg "Thanks, but this change is outdated now"