提交 aaace7b6 编写于 作者: S storypku 提交者: Liu Jiaming

Docs: updated how_to_create_pull_request

上级 29a22dea
......@@ -14,7 +14,7 @@
## Contribution
- [How to document code](how_to_document_code.md)
- [How to style check your code contribution](how_to_style_check_to_one_dir.md)
- [How to create a pull request](how_to_create_a_pull.md)
- [How to create a pull request](how_to_create_pull_request.md)
- [How to migrate to the updated apollo master from previous versions.md](how_to_migrate_to_the_updated_apollo_master_from_old_versions.md)
### Chinese versions
......
# How to create a pull request
You can follow the standard [github approach](https://help.github.com/articles/using-pull-requests/) to contribute code to Apollo. Here is a sample setup:
- Fork a new repo with your GitHub username.
- Set up your GitHub personal email and user name
```
git config user.name "XXX"
git config user.email "XXX@[XXX.com]"
```
- Clone your fork (Please replace "USERNAME" with your GitHub user name.)
```
(Use SSH) git clone git@github.com:USERNAME/apollo.git
(Use HTTPS) git clone https://github.com/USERNAME/apollo.git
```
- Add Apollo repository as upstream
```
(Use SSH) git remote add upstream git@github.com:ApolloAuto/apollo.git
(Use HTTPS) git remote add upstream https://github.com/ApolloAuto/apollo.git
```
- Confirm that the upstream branch has been added
```
git remote -v
```
- Create a new branch, make changes and commit
```
git checkout -b "my_dev"
```
- Sync up with the Apolloauto/apollo repo
```
git pull --rebase upstream master
```
- Push local developments to your own forked repository
```
git push -f -u origin "my_dev"
```
- Generate a new pull request between "Apolloauto/apollo:master" and "forked repo:my_dev"
- Collaborators will review and merge the commit (this may take some time, please be patient)
Thanks a lot for your contributions!
# How to Create a Pull Request
This document is a brief step-by-step guide on creating pull requests for
Apollo. Your can also refer to
[GitHub: Using Pull Requests](https://help.github.com/articles/using-pull-requests/)
for a thorough understanding.
## Step 1: Fork your own copy of ApolloAuto/apollo to your GitHub account
This is done by clicking the "Fork" button on the top-right of
[Apollo's Github Page](https://github.com/ApolloAuto/apollo) and following the
guide there.
## Step 2: Clone your fork of the repo
Note:
> Please replace "YOUR USERNAME" with your GitHub account in the descriptions
> below.
Open a terminal, type the following:
```
# Using SSH
git clone git@github.com:YOUR_USERNAME/apollo.git
# Using HTTPS
git clone https://github.com/YOUR_USERNAME/apollo.git
```
## Step 3: Set up your username and email for this repo
```
git config user.name "My Name"
git config user.email "myname@example.com"
```
## Step 4: Set official Apollo repo as upstream
Configuring an upstream remote allows you to sync changes made in the upstream
with your own fork.
This is done with the following command:
```
# Using SSH
git remote add upstream git@github.com:ApolloAuto/apollo.git
# Using HTTPS
git remote add upstream https://github.com/ApolloAuto/apollo.git
```
You can confirm that the upstream repo has been added by running:
```
git remote -v
```
If successful, it will show the list of remotes similar to the following:
```
origin git@github.com:YOUR_USERNAME/apollo.git (fetch)
origin git@github.com:YOUR_USERNAME/apollo.git (push)
upstream git@github.com:ApolloAuto/apollo.git (fetch)
upstream git@github.com:ApolloAuto/apollo.git (push)
```
## Step 5: Create a new branch; Make and commit changes
```
git checkout -b my_dev origin/master
# Make your own changes on branch "my_dev"
# blah blah ...
# Commit to your own branch with commit msg:
git commit -m "[module] brief description of the changes"
```
## Step 6: Sync up with upstream ApolloAuto/apollo
```
git pull --rebase upstream master
```
## Step 7: Push your local changes to your fork.
```
git push -f -u origin my_dev
```
## Step 8: Generate a pull request
Create a new pull request between "Apolloauto/apollo:master" and
"YOUR_USERNAME/apollo:my_dev" by clicking the "Pull Request" button on
[your forked Apollo repo page](https://github.com/YOUR_USERNAME/apollo) on
GitHub.
You can then follow the steps described by
[GitHub: Creating a Pull Request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork)
on what to do next.
Note:
> Please don't forget to **add the description of your PR**. It can help
> reviewers better understand the changes you have made and the intention for
> those changes.
Collaborators from our team will be glad to review and merge your commit! (This
may take some time, please be patient.)
## Step 9: Done!
Thanks a lot for your PR!
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册