Skip to main content

Overview

Pull requests (PRs) are the primary mechanism for proposing, reviewing, and merging code changes in Gitea. They enable team collaboration through code review, automated testing, and controlled merging strategies.

Creating Pull Requests

1

Create Feature Branch

Start by creating a branch for your changes:
2

Open Pull Request

Navigate to the repository in Gitea and click New Pull Request
3

Configure PR Details

  • Base Branch: Target branch for merge (usually main)
  • Compare Branch: Your feature branch
  • Title: Descriptive PR title
  • Description: Detailed explanation of changes
  • Reviewers: Request reviews from team members

Code Review

Review Process

Gitea provides a comprehensive code review workflow:
  • Inline Comments: Comment on specific lines of code
  • Suggested Changes: Propose code modifications that can be applied directly
  • Review Status: Approve, request changes, or comment
  • Conversation Resolution: Mark comment threads as resolved

Review Requirements

Configure branch protection to enforce review requirements:
  • Minimum number of approvals
  • Required review from code owners
  • Dismiss stale approvals on new commits
  • Block merge until all reviews are approved

Merge Strategies

Gitea supports multiple merge strategies:

Merge Commit

Creates a merge commit preserving full history

Rebase

Rebases commits onto base branch for linear history

Squash

Combines all commits into a single commit

Fast-Forward

Only if fast-forward is possible (no divergence)

Merge Commit

Preserves complete commit history:

Rebase and Merge

Rebases feature branch commits onto base branch:

Squash and Merge

Combines all commits into one:

Automated Checks

Status Checks

Integrate CI/CD pipelines and automated testing:
  • Gitea Actions: Run workflows on PR events
  • External CI: GitHub Actions, Jenkins, Travis CI
  • Status API: Report check results via API

Required Checks

Configure required status checks in branch protection:

Merge Conflict Resolution

When conflicts occur:
1

Update Your Branch

2

Resolve Conflicts

Edit conflicting files and resolve markers:
3

Complete Merge

Advanced Features

Draft Pull Requests

Create work-in-progress PRs:
  • Mark PR as draft to indicate it’s not ready for review
  • Prevents accidental merging
  • Convert to ready when complete

Auto-Merge

Schedule automatic merging when conditions are met:
  • All required checks pass
  • Required approvals obtained
  • No blocking reviews

Pull Request Templates

Create .gitea/pull_request_template.md:

Best Practices

Keep PRs Small

Smaller PRs are easier to review and merge faster

Clear Descriptions

Explain what, why, and how of your changes

Link Issues

Reference related issues (Fixes #123)

Respond Promptly

Address review feedback quickly

See Also

Issues

Issue tracking and project management

Actions

CI/CD with Gitea Actions

Repositories

Repository management features

API Reference

Pull Request API endpoints