Shortcuts

Pull Request (PR)

What is PR

PR is the abbreviation of Pull Request. Here’s the definition of PR in the official document of Github.

Pull requests let you tell others about changes you have pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.

Basic Workflow

  1. Get the most recent codebase

  2. Checkout a new branch from the master branch

  3. Commit your changes

  4. Push your changes and create a PR

  5. Discuss and review your code

  6. Merge your branch to the master branch

Procedures in detail

1. Get the most recent codebase

  • When you work on your first PR

    Fork the OpenMMLab repository: click the fork button at the top right corner of Github page avatar

    Clone forked repository to local

    git clone git@github.com:XXX/mmcv.git
    

    Add source repository to upstream

    git remote add upstream git@github.com:open-mmlab/mmcv
    
  • After your first PR

    Checkout master branch of the local repository and pull the latest master branch of the source repository

    git checkout master
    git pull upstream master
    

2. Checkout a new branch from the master branch

git checkout -b branchname

Tip

To make commit history clear, we strongly recommend you checkout the master branch before create a new branch.

3. Commit your changes

# coding
git add [files]
git commit -m 'messages'

4. Push your changes to the forked repository and create a PR

  • Push the branch to your forked remote repository

    git push origin branchname
    
  • Create a PR avatar

  • Revise PR message template to describe your motivation and modifications made in this PR. You can also link the related issue to the PR manually in the PR message (For more information, checkout the official guidance).

5. Discuss and review your code

  • After creating a pull request, you can ask a specific person to review the changes you’ve proposed avatar

  • Modify your codes according to reviewers’ suggestions and then push your changes

6. Merge your branch to the master branch and delete the branch

git branch -d branchname # delete local branch
git push origin --delete branchname # delete remote branch

PR Specs

  1. Use pre-commit hook to avoid issues of code style

  2. One short-time branch should be matched with only one PR

  3. Accomplish a detailed change in one PR. Avoid large PR

    • Bad: Support Faster R-CNN

    • Acceptable: Add a box head to Faster R-CNN

    • Good: Add a parameter to box head to support custom conv-layer number

  4. Provide clear and significant commit message

  5. Provide clear and meaningful PR description

    • Task name should be clarified in title. The general format is: [Prefix] Short description of the PR (Suffix)

    • Prefix: add new feature [Feature], fix bug [Fix], related to documents [Docs], in developing [WIP] (which will not be reviewed temporarily)

    • Introduce main changes, results and influences on other modules in short description

    • Associate related issues and pull requests with a milestone

Read the Docs v: latest
Versions
master
latest
v1.5.2_a
v1.5.1
v1.5.0
v1.4.8
v1.4.7
v1.4.6
v1.4.5
v1.4.4
v1.4.3
v1.4.2
v1.4.1
v1.4.0
v1.3.18
v1.3.17
v1.3.16
v1.3.15
v1.3.14
v1.3.13
v1.3.12
v1.3.11
v1.3.10
v1.3.9
v1.3.8
v1.3.7
v1.3.6
v1.3.5
v1.3.4
v1.3.3
v1.3.2
v1.3.1
v1.3.0
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.