my-git

Fork and Pull Request Workflow

English 中文

Fork + PR is suited for open-source projects and external contributor scenarios.

Its core principle is: contributors develop in their own forks, then request maintainers to merge via PRs, eliminating the need for direct write access to the main repository.

Process

fork upstream -> create branch -> commit -> open PR -> maintainer review -> merge

Suitable Scenarios

Contributor Process

git clone git@github.com:your-name/project.git
cd project
git remote add upstream git@github.com:owner/project.git
git switch -c docs/update-guide

Sync with upstream:

git fetch upstream
git rebase upstream/main

Push to your own fork:

git push -u origin docs/update-guide

Then open a PR from the GitHub page.

Maintainer Checklist

Common Issues

1. Fork falls too far behind upstream

Contributors should sync upstream/main regularly.

2. PR scope is too large

Maintainers can ask contributors to split the PR.

3. CI permissions and secret risks

PRs from forks require attention to CI permissions and secret exposure risks, especially when automated scripts execute code from external contributors.

How to Use Internally in Enterprises

If all enterprise members are within the same organization, defaulting to the Forking Workflow is usually unnecessary.

However, in these scenarios, forks still hold value:

For purely internal business services, feature branch + protected main is often simpler.

Extended Reading