Skip to content

拉取请求

一句话解释

拉取请求 (PR) 是 proposal 到合并更改从 one 分支到 another, 使用 code review and discussion 之前合并.

用大白话说

A pull request is a GitHub/GitLab feature (not a Git command) that proposes merging a branch's changes into a target branch. It provides a diff view, discussion thread, inline code comments, and approval workflow before the merge happens.

The typical flow: create a feature branch, make commits, push the branch, open a PR on GitHub targeting main. Teammates review the diff, leave comments, request changes, and approve. Once approved, the PR is merged (either via GitHub's merge button or command line).

PRs are the heart of team collaboration. They ensure code is reviewed before reaching the main branch, provide a record of why changes were made, and integrate with CI/CD to run tests automatically. The term "拉取请求" comes from the idea that you are requesting the target repository to pull your changes.

示例

bash
# Create and push a feature branch
git checkout -b feature/add-login
git add .
git commit -m "Add login form"
git push -u origin feature/add-login

# Then open a PR on GitHub targeting main
# GitHub URL: https://github.com/user/repo/compare/main...feature/add-login

推送分支, 然后打开 PR on GitHub for review 之前合并.

相关术语

相关资源

相关课程

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表