关于如何向MMDet提交PR,请参考mmcv的文档《拉取请求 — mmcv 1.6.1 文档》
当第一次提PR时,需要复刻OpenMMLab代码库,点击 GitHub 页面右上角的Fork按钮即可
将复刻的代码库克隆到本地
git clone fork_mmdetection_git
设置官方repo为上游代码库
git remote add upstream official_mmdetection_git
Note
这里的upstream是远程仓库的名称(),类似于备注。
查看本地所有分支
git branch
因为pre-commit
会对MD文件进行格式化,从而对文件内容进行修改,这些修改也是需要被索引然后提交的,所以pre-commit
需要在git-add-commit之前进行;
pre-commit
工具python -m pip install pre-commit -i https://pypi.doubanio.com/simple
pre-commit run --all-files
git add [files]
git add .
git commit -m "decribe_the_changes"
git push origin local_dev
第一次push:还需要在自己的 fork-repo 中手动点击按钮创建PR;
第二次push:GitHub会自动将修改推送到PR中,不需要手动进行更新了。
在推送修改时,出现了这样的错误提示:
To https://github.com/…/mmdetection.git
! [rejected] 3.x_doc -> 3.x_doc (non-fast-forward)
error: failed to push some refs to ‘https://github.com/…/mmdetection.git’
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: ‘git pull …’) before pushing again.
hint: See the ‘Note about fast-forwards’ in ‘git push --help’ for details.
引起这个错误的原因是,上游仓库已经添加了新的内容,(为了防止推送出现conflict),远程仓库拒绝了推送;
这里我们需要首先 git-pull更新本地的仓库,然后再进行修改;
因为格式化包中用到了 typed_ast 包,而这个包的repo在文档中声明不支持python3.8以上的版本,所以需要使用python3.7进行编译;