简体   繁体   English

是否可以仅在最后一次提交更改时发出请求?

[英]It is possible to make pull request with last commit changes only?

I have 2 master branches for 2 different versions of my application. 我有2个主分支,分别用于我的应用程序的2个不同版本。 I want to make fixes for both them using a pull request, but I want to include in it only the last commit. 我想使用拉取请求对它们两者进行修复,但是我只想在其中包含最后一次提交。 One of those branches has a few (~5) commits that the other branch doesn't have, because only one of them is supported now. 其中一个分支有几个(〜5)提交,而另一个分支则没有,因为现在仅支持其中一个。

I using Atlassian's Stash. 我使用Atlassian的Stash。

Make a new branch from the master you are merging into . 请从要合并主一个新的分支。 Cherry pick the commit you want to merge into that branch. Cherry选择您要合并到该分支中的提交。 Then open a pull request for that branch. 然后打开该分支的拉取请求。

Alternately, rather than a full-blown pull request, you could just cherry-pick the commit from one into the other. 或者,您可以只将提交从一个请求中挑选到另一个中,而不是全面的请求。

Start here, where M1 is the branch you want to merge into, and e is the commit with the fix you want in both branches: 从这里开始,其中M1是要合并到的分支, e是在两个分支中具有所需修订的提交:

-M1

-M2-a-b-c-d-e

Simplest is just to cherry-pick the fix: 最简单的方法就是挑选解决方案:

$ git checkout M1
$ git cherry-pick e

That gets you this: 那给你这个:

-M1-e'

-M2-a-b-c-d-e

If you must do a pull request, try this: 如果必须执行拉取请求,请尝试以下操作:

$ git checkout M1
$ git checkout -b M3
$ git cherry-pick e

That will get you this: 那会给你这个:

-M1
  \
   M3-e'

-M2-a-b-c-d-e

...and once you issue the pull request and it gets merged - most likely a fast-forward merge - you'll be back here: ...并且一旦您发出拉取请求并将其合并-最有可能是快速合并-您将回到此处:

-M1-e''

-M2-a-b-c-d-e

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM