git - 如何发送合并请求?
问题描述
我在本地的 master 中完成了更改,我不想只是推送它们,而是我想创建一个新分支并让它包含所有想法,然后将其与 master 合并。
git status 显示所有更改的文件都已使用 git add 添加并使用 git commit -m "something" 提交但未推送,不确定这是否会影响后面的步骤。
我做了什么:
# Start a branch called new-feature
git checkout -b new-feature master
# Edit some files
git add <file>
git commit -m "something"
# Merge in the new-feature branch
git checkout master
git merge new-feature
git branch -d new-feature
但这没有用
解决方案
您可以创建一个包含当前分支的当前状态的分支(在本例中为 master 分支)。为此,请运行以下行:
git checkout -b <new_branch_name>
运行这一行,您将位于新创建的分支中,其中包含您所做的本地提交。现在,您可以从这个新分支 ( ) 推送更改git push -u origin <new_branch_name>
,然后向 master(或您想要的任何分支)打开一个 Pull Request。
要打开拉取请求,您可以访问存储库页面(例如,https://github.com/<your_user>/<your_repo>
)并按下按钮new pull request
。然后您只需选择来源和命运,添加一条消息并创建它。
推荐阅读
- ios - iOS 12 stringFromDate 方法返回不正确的值
- javascript - 动态更新 PayPal 按钮/iframe 上的“金额”?
- c - 在 C 中,是否可以在不移动缓冲区指针的情况下从 getchar 的当前缓冲区位置读取字符?
- angularjs - ng-src 不适用于 angularjs 中的视频标签
- scala - 遍历scala中的日期范围
- vue.js - 多个字段和值的 Vue 搜索过滤器
- typescript - 自我实例的类型
- hadoop - Zeppelin:猪脚本问题
- python-3.x - 没有分隔符时,如何在 Python 中将 .txt 文件读取为 n 维 numpy 数组?
- java - Hibernate - 具有接口属性的实体类