如何从零创建gitee pull-request

如何创建gitee pull-request

更多关注
计算机视觉-Paper&Code - 知乎

前置条件

  • 仔细阅读contributing文档 https://gitee.com/ascend/modelzoo/blob/master/contrib/CONTRIBUTING.md
  • 提交CLA签名验证,https://clasign.osinfra.cn/sign/Z2l0ZWUlMkZhc2NlbmQ=
  • repo需要等待前一个模型pull-request已经合入后在操作下一个

流程步骤

  • 代码使用pep8规范 https://www.cnblogs.com/xiao-apple36/p/9242069.html
import os
def walkFile(file):
    for root, dirs, files in os.walk(file):
        for f in files:
            if f.endswith("py"):
                os.system(
                    "autopep8 --in-place --aggressive " + os.path.join(root, f))
                print(os.path.join(root, f))

walkFile(".")

  • c++代码使用google规范

File --> Preference --> setting --> 搜索 clang_format --> 在C_Cpp:Clang_format_fallback Style的输入窗中填入:
{
    
     BasedOnStyle: Google, UseTab: Never, IndentWidth: 4, TabWidth: 4 }

# 安装批量format文件工具
https://marketplace.visualstudio.com/items?itemName=jbockle.jbockle-format-files
  • 注释一律使用英文
可以使用全局搜索替换,正则查询中文
(.[\u4E00-\u9FA5]+)|([\u4E00-\u9FA5]+.)
  • 配置repo公钥,使用 git remote set-url origin remote_git_address 修改remote

  • 进入modelzoo,并gitee页面上点击fork按钮

  • 克隆fork后的repo到本地

git clone https://gitee.com/wscjxky/modelzoo/
# 如果已经fork了,则需要与modelzoo主master进行同步
# 添加repo远程仓库地址到upstream
#git remote add upstream https://gitee.com//modelzoo.git
# 添加repo远程仓库地址到upstream
git remote add upstream  https://gitee.com//models
# 把repo更新到本地的upstream里
git fetch upstream
# merge远程最新的代码到本地
git merge upstream/master  --allow-unrelated-histories
# 提交本地改动到远程分支
git push

  • 将需要修改的代码替换掉原始Ascend modelzoo中的代码,并push到远程分支中
# 原始代码
# git clone -b r1.1  --depth 1 https://gitee.com/

git add .
git commit -m "1"
git push 
  • 进入当前用户的gitee modelzoo中,点击pull requests按钮并创建新的pr。
  • 需要标明合入的commit id以及被合入的commit id 可参考链接

猜你喜欢

转载自blog.csdn.net/weixin_43953700/article/details/123698905