title | language |
---|---|
Code Submission Guide |
en |
Pull Request (PR) can be easily submitted on Github. The PR method of Doris project is described below.
Go to the github page of apache/doris , and click the button Fork
in the upper right corner for Fork.
git clone https://github.com/<your_github_name>/doris.git
Note: Please replace your GitHub name with your yourgithubname.
When clone is completed, origin defaults to the remote fork address on github.
cd doris
git remote add upstream https://github.com/apache/doris.git
git remote -v
origin https://github.com/<your_github_name>/doris.git (fetch)
origin https://github.com/<your_github_name>/doris.git (push)
upstream https://github.com/apache/doris.git (fetch)
upstream https://github.com/apache/doris.git (push)
git checkout -b <your_branch_name>
Note: <your_branch_name> name is customized for you.
Code changes can be made after creation.
git commit -a -m "<you_commit_message>"
git push origin <your_branch_name>
For more git usage, please visit: git usage, not to mention here.
Switch to your GitHub page in the browser, switch to the submitted branch yourbranchname\ and click the Compare & pull request
button to create it, as shown in the following figure:
At this time, the Create pull request
button will appear. If not, please check whether the branch is selected correctly or click on `compare across forks' to re-select the repo and branch.
Here, please fill in the summary and details of the comment, and then click Create pull request
to create it.
For how to write Commit Message, here are some Tips:
- Please use the form of English verb + object. The verb does not use the past tense and the sentence uses imperative sentence.
- Subject and body should be written, and they should be separated by blank lines (fill in separately on GitHub PR interface).
- Message topic length should not exceed 50 characters;
- Message content should not exceed 72 characters per line, and the excess should be replaced manually.
- Message content is used to explain what has been done, why and how.
- The first letter of the message subject should be capitalized, and the end of the sentence should not have a full stop.
- The message content specifies the associated issue (if any), such as # 233;
For more details, see https://chris.beams.io/posts/git-commit.
After successful creation, you can see that Doris project needs review, you can wait for us to review and join, you can also contact us directly.
So far, your PR creation is complete. Read more about PR [collaborating-with-issues-and-pull-requests] (https://help.github.com/categories/collaborating-with-issues-and-pull-requests/).
When submitting PR, code conflicts are usually caused by multiple people editing the same file. The main steps to resolve conflicts are as follows:
git checkout master
git pull upstream master
git checkout fix
git rebase -i master
At this point, a file that modifies the record will pop up and can be saved directly. Then, we will prompt which files have conflicts. At this time, we can open the conflict file to modify the conflict part. After all the conflicts of the conflict files are resolved, we will execute them.
git add .
git rebase --continue
Then you can go back and forth until the screen appears something like * rebase successful * and then you can update the branch that submitted PR:
git push -f origin fix
$ git branch
* master
$ git fetch upstream
remote: Counting objects: 195, done.
remote: Compressing objects: 100% (68/68), done.
remote: Total 141 (delta 75), reused 108 (delta 48)
Receiving objects: 100% (141/141), 58.28 KiB, done.
Resolving deltas: 100% (75/75), completed with 43 local objects.
From https://github.com/apache/doris
9c36200..0c4edc2 master -> upstream/master
$ git rebase upstream/master
First, rewinding head to replay your work on top of it...
Fast-forwarded master to upstream/master.
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 8 commits.
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# custom_env.sh
nothing added to commit but untracked files present (use "git add" to track)
$ git push origin master
Counting objects: 195, done.
Delta compression using up to 32 threads.
Compressing objects: 100% (41/41), done.
Writing objects: 100% (141/141), 56.66 KiB, done.
Total 141 (delta 76), reused 140 (delta 75)
remote: Resolving deltas: 100% (76/76), completed with 44 local objects.
To https://lide-reed:[email protected]/lide-reed/doris.git
9c36200..0c4edc2 master -> master
$ git checkout -b my_branch
Switched to a new branch 'my_branch'
$ git branch
master
* my_branch
$ git add -u
$ git commit -m "Fix a typo"
[my_branch 55e0ba2] Fix a typo
1 files changed, 2 insertions(+), 2 deletions(-)
$ git push origin my_branch
Counting objects: 11, done.
Delta compression using up to 32 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 534 bytes, done.
Total 6 (delta 4), reused 0 (delta 0)
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
remote:
remote: Create a pull request for 'my_branch' on GitHub by visiting:
remote: https://github.com/lide-reed/doris/pull/new/my_branch
remote:
To https://lide-reed:[email protected]/lide-reed/doris.git
* [new branch] my_branch -> my_branch
At this point, you can create PR according to the previous process.