Code Submission Guide

Pull Request (PR)Code Submission Guide - 图1 (opens new window) can be easily submitted on GithubCode Submission Guide - 图2 (opens new window). The PR method of Doris project is described below.

Fork Repository

Go to the github pageCode Submission Guide - 图3 (opens new window) of apache/incubator-doris , and click the button Fork in the upper right corner for Fork.

Fork

2. Configuring GIT and submitting modifications

(1) Clone the code locally:

  1. git clone https://github.com/<your_github_name>/incubator-doris.git

Note: Please replace your GitHub name with your yourgithubname\\\\\\\.

When clone is completed, origin defaults to the remote fork address on github.

(2) Add apache/incubator-doris to the remote branch upstream of the local warehouse:

  1. cd incubator-doris
  2. git remote add upstream https://github.com/apache/incubator-doris.git

(3) Check remote warehouse settings:

  1. git remote -v
  2. origin https://github.com/<your_github_name>/incubator-doris.git (fetch)
  3. origin https://github.com/<your_github_name>/incubator-doris.git (push)
  4. upstream https://github.com/apache/incubator-doris.git (fetch)
  5. upstream https://github.com/apache/incubator-doris.git (push)

(4) New branches to modify them:

  1. git checkout -b <your_branch_name>

Note: <your_branch_name> name is customized for you.

Code changes can be made after creation.

(5) Submit code to remote branch:

  1. git commit -a -m "<you_commit_message>"
  2. git push origin <your_branch_name>

For more git usage, please visit: git usageCode Submission Guide - 图5 (opens new window), not to mention here.

3. Create PR

(1) New PR

Switch to your GitHub page in the browser, switch to the submitted branch yourbranchname\ and click the New pull request button to create it, as shown in the following figure:

new PR

(2) preparation branch

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.

create PR

(3) Fill Commit Message

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-commitCode Submission Guide - 图8 (opens new window).

create PR

(4) Complete the creation

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.

create PR

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/).

4. Conflict Resolution

When submitting PR, code conflicts are usually caused by multiple people editing the same file. The main steps to resolve conflicts are as follows:

(1) Switch to the main branch

  1. git checkout master

(2) Synchronize remote main branch to local

  1. git pull upstream master

(3) Switch back to the previous branch (assuming the branch is named fix)

  1. git checkout fix

(4) rebase

  1. 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.

  1. git add .
  2. 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:

  1. git push -f origin fix

5. An example

(1) fetch to the latest code for the local branch of upstream that has been configured

  1. $ git branch
  2. * master
  3. $ git fetch upstream
  4. remote: Counting objects: 195, done.
  5. remote: Compressing objects: 100% (68/68), done.
  6. remote: Total 141 (delta 75), reused 108 (delta 48)
  7. Receiving objects: 100% (141/141), 58.28 KiB, done.
  8. Resolving deltas: 100% (75/75), completed with 43 local objects.
  9. From https://github.com/apache/incubator-doris
  10. 9c36200..0c4edc2 master -> upstream/master

(2) rebase

  1. $ git rebase upstream/master
  2. First, rewinding head to replay your work on top of it...
  3. Fast-forwarded master to upstream/master.

(3) Check to see if other submissions are not synchronized to their own repo submissions

  1. $ git status
  2. # On branch master
  3. # Your branch is ahead of 'origin/master' by 8 commits.
  4. #
  5. # Untracked files:
  6. # (use "git add <file>..." to include in what will be committed)
  7. #
  8. # custom_env.sh
  9. nothing added to commit but untracked files present (use "git add" to track)

(4) Merge code submitted by others into their own repo

  1. $ git push origin master
  2. Counting objects: 195, done.
  3. Delta compression using up to 32 threads.
  4. Compressing objects: 100% (41/41), done.
  5. Writing objects: 100% (141/141), 56.66 KiB, done.
  6. Total 141 (delta 76), reused 140 (delta 75)
  7. remote: Resolving deltas: 100% (76/76), completed with 44 local objects.
  8. To https://lide-reed:fc35ff925bd8fd6629be3f6412bacee99d4e5f97@github.com/lide-reed/incubator-doris.git
  9. 9c36200..0c4edc2 master -> master

(5) New branch, ready for development

  1. $ git checkout -b my_branch
  2. Switched to a new branch 'my_branch'
  3. $ git branch
  4. master
  5. * my_branch

(6) Prepare to submit after code modification is completed

  1. $ git add -u

(7) Fill in the message and submit it it to the new local branch

  1. $ git commit -m "Fix a typo"
  2. [my_branch 55e0ba2] Fix a typo
  3. 1 files changed, 2 insertions(+), 2 deletions(-)

(8) Push the branch into GitHub’s own repo far away

  1. $ git push origin my_branch
  2. Counting objects: 11, done.
  3. Delta compression using up to 32 threads.
  4. Compressing objects: 100% (6/6), done.
  5. Writing objects: 100% (6/6), 534 bytes, done.
  6. Total 6 (delta 4), reused 0 (delta 0)
  7. remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
  8. remote:
  9. remote: Create a pull request for 'my_branch' on GitHub by visiting:
  10. remote: https://github.com/lide-reed/incubator-doris/pull/new/my_branch
  11. remote:
  12. To https://lide-reed:fc35ff925bd8fd6629be3f6412bacee99d4e5f97@github.com/lide-reed/incubator-doris.git
  13. * [new branch] my_branch -> my_branch

At this point, you can create PR according to the previous process.