网页制作模板的淘宝网站代码,乐达淄博网站建设制作,wordpress打电话聊插件,搜索引擎营销的方法github 上面有很多非常不错的开源项目#xff0c;我们也可以向其贡献自己的代码#xff0c;那么我们如何提交自己的代码给开源项目呢#xff1f;这里就要用到 pull request 的提交方式。当然#xff0c;基于 git 的其他平台也是类似的用法。 假设源仓库为#xff1a;https…github 上面有很多非常不错的开源项目我们也可以向其贡献自己的代码那么我们如何提交自己的代码给开源项目呢这里就要用到 pull request 的提交方式。当然基于 git 的其他平台也是类似的用法。 假设源仓库为https://github.com/test/pro你 fork 后得到的仓库为https://github.com/your/pro。 流程如下所示 1. 在开发环境克隆 fork 的仓库 $ git clone https://github.com/your/pro 2. 添加仓库的 upstream 源 添加 upstream 源才可以同步源仓库代码变动到你 fork 的仓库。 $ cd pro\r\n$ git remote add upstream https://github.com/test/pro 3. 新建 feature 分支 每次修改代码时都新建一个分支开发功能或者修复 bug当然分支的名字自己定。 $ git checkout -b feature 4. 提交分支 代码修改完成后提交 feature 分支 $ git add ./
$ git commit -m some notes
$ git push origin feature 4. push feature 分支到 upstream 仓库 这里 upstream 仓库为 https://github.com/test/pro。在 github 网站上面创建 pull request然后等待负责人处理你的 pull request。 5. 删除 feature 分支 如果你的 pull request 被合并且关闭了那么你就可以删除 feature 分支了。 首先切换到 master 分支 $ git checkout master 然后删除本地 feature 分支 $ git branch -d feature 再删除远程 feature 分支 $ git push origin --delete reature 6. 同步代码 在你 fork 的项目中更改修改的代码全在 feature 分支中而此时 feature 分支已经被删除了不过不用担心因为修改的代码已经被源仓库合并所以此时需要同步源仓库的代码 $ git pull upstream master
$ git push origin master 转载于:https://www.cnblogs.com/hojas/p/9523243.html