在github上的pull request-显示从master重新提交的提交 [英] Pull request on github - showing commits rebased from master

查看:89
本文介绍了在github上的pull request-显示从master重新提交的提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与一个团队合作,我们正在进行功能分支和提取请求.

I'm working with a team and we're doing feature branches and pull requests.

我创建了一个分支,对其做了一些工作,同时在master上也做很少的工作.

I created a branch, worked on it a bit while also doing little work on master.

然后,我根据master重新设置分支.现在,我要执行拉取请求.

Then, I rebased the branch against master. Now I want to do a pull request.

但是,在GitHub中,pull请求显示了我第一次创建分支到现在之间发生的所有提交-我在该功能分支上所做的提交以及在主分支之间进行的提交.

However, in GitHub, the pull request shows all the commits that happened between when I first made the branch and now - the commits I did on this feature branch, and the commits that are on master that happened in between.

这是嘈杂的杂物-我做错什么了吗?我希望pull请求只显示我所做的提交,因为其他提交已经在master和我的分支上了,没什么区别.

This is noisy clutter - am I doing something wrong? I'd like the pull request to just show the commits that I've made, since the other commits are already on both master and on my branch, no difference.

我看到的唯一建议是根据最新的上游主服务器创建另一个分支,并从我的分支中进行樱桃采摘.

The only suggestion I see is making another branch based on the latest upstream master and cherry picking commits from my branch onto it.

推荐答案

我曾经遇到过同样的问题:

I used to have the same problem:

如果我们有foo分支,是从master分支的,已经被推送到origin,并且在两个分支上都进行了更改,那么在合并/重新设置基准之后,我将在Pull Request的master中获取更改.差异

If we have foo branch, branched from master, which is already pushed into origin, and on both branches changes were made, then after merging/rebasing I was getting changes from master in Pull Request's diff.

我先执行git fetch,更新我的本地master分支,将本地分支更改为foo,然后执行命令来解决此问题:

I solved it by executing git fetch first, updating my local master branch, changing local branch to foo and then executing commands:

git rebase master

git push -f origin foo:foo

这将强制执行远程分支,然后PR的差异仅包含适当的更改,就像将根据最近的master创建分支一样.

This is forcing remote branch and then PR's diff contains only proper changes, exactly as the branch would be created based on recent master.

这篇关于在github上的pull request-显示从master重新提交的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆