简体   繁体   English

从git中的合并提交对特定文件应用差异

[英]Apply a diff on a specific file from a merge commit in git

I am doing a rebase that includes a merge conflict that I already resolved in a merge commit in another branch. 我正在做一个基准,其中包括我已经在另一个分支的合并提交中解决的合并冲突。 Is there a way to apply that resolution on the respective file from the merge commit? 有没有办法将合并提交中的相应文件应用该分辨率? Basically, given a merge commit, I want to apply the diff of the +'s and -'s from the second column over a specific file. 基本上,给定一个合并提交,我想将第二列中+和-的差异应用于特定文件。 I hope that makes sense. 我希望这是有道理的。

It's a little late now, but using git rerere can make this much easier if it comes up a lot. 现在有点晚了,但是使用git rerere可以使事情变得容易得多。

At this point, what I would try first is a git cherry-pick -n -m [1 or 2] [merge commit SHA1] , then only commit the changes to the one file (by resetting the other ones or whatever), then do your rebase. 在这一点上,我首先尝试的是git cherry-pick -n -m [1 or 2] [merge commit SHA1] ,然后仅将更改提交到一个文件中(通过重置其他文件或其他内容),然后做你的基础。

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

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