怎么在GitHub上向开源库中提交代码

来源:互联网 发布:linux环境变量配置修改 编辑:程序博客网 时间:2024/04/26 06:10

怎么在GitHub上向开源库中提交代码

  1. fork想要提交代码的开源库的代码到自己的GitHub项目中
  2. 将自己fork后的代码clone到PC上. // remote origin

    git clone https://github.com/xxx

  3. 添加开源库代码的GitHub路径到PC代码中的remote中. // remote upstream

    git remote add upstream https://github.com/yyy

  4. 在本地代码中创建新分支

    git checkout -b new-branch origin/master

  5. 修改代码

  6. 将本地新分支的代码提交到自己的GitHub上. // remote origin

    git push origin new-branch

  7. 打开GitHub网站,进入到项目页,选择新提交的分支

  8. 点击页面左边Compare and Review按钮

  9. 在比较页中点击Create pull request

  10. 输入一个标题和描述内容

  11. 点击Create pull request

0 0