合并后不应用修补程序 [英] Patch not applied after it gets merged

查看:138
本文介绍了合并后不应用修补程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 git flow 工具,我创建了一个功能分支(分支 dev ),更改并将分支合并回到 dev



我在功能分支中修改了一个文件。我可以确认修改该文件( FILE-A )的修订(让我们称之为 REV-A )为然后在合并之后, FILE-A 处于其原始状态(存在并应用于功能分支中)。

预合并)状态在 dev 分支上。我可以在 dev git log 时看到 REV-A c>,如果我按照 git log --graph 产生的行,我可以跟踪这个提交到合并提交,在那里我合并了我的特性分支和



然而,当我做一个 git blame code> FILE -A ,提交不在那里,并且有问题的行在它的原始文件中(pre REV-A commit) )。



另外, git show REV-A | patch -p1 导致修补程序被干净地应用。之后, git diff 看起来与 git show REV-A 相同。



发生了什么事?合并是如何将修订引入分支历史记录的,但实际上并不适用它?是否还有其他合并中没有被应用的更改???

解决方案

您是否仍然拥有您运行的命令?这将有助于追踪事情可能出错的地方。我不禁想到,该功能没有正确完成。你可以确认你输入了 git flow feature finish my_feature



我用下面的命令模拟了一个功能,但没有遇到你描述的问题。如果你的步骤偏离了我在下面的步骤,那么比较如何以及在哪里可以很好。

  MBP:git-test acanby (主)$ echo原始代码> file.txt 
MBP:git-test acanby(master)$ git commit -am第一次提交
MBP:git-test acanby(master)$ git flow init
MBP:git-测试acanby(开发)$ git flow功能开始my_feature
MBP:git-test acanby(功能/ my_feature)$ echo此处新功能>> file.txt
MBP:git-test acanby(feature / my_feature)$ git commit -am功能改变
MBP:git-test acanby(功能/ my_feature)$ git流程功能完成my_feature
MBP:git-test acanby(开发)$ git blame file.txt
^ d96c279(acanby 2015-02-16 20:36:22 +1100 1)原始码
62a38725(acanby 2015- 02-16 20:38:37 +1100 2)新功能
MBP:git-test acanby(开发)$ git log --oneline
62a3872功能更改
d96c279第一次提交

使用这些命令,我​​可以使用git-flow工作流完成一项功能。

如果您想了解更多关于git-flow工作流程的信息(特别是命令以及它们的功能),可以使用一个很好的备忘单这里


Using the git flow tool, I created a feature branch (branched off dev), made a bunch of changes, and merged the branch back onto dev.

There is a file which I have modified in the feature branch. I can confirm that the revision (let's call it REV-A) that modifies the file (FILE-A) is present and applied in the feature branch.

However, after the merge, FILE-A is in its original (pre-merge) state on the dev branch. I can see REV-A when I do git log on dev, and if I follow the lines produced by git log --graph, I can trace this commit forward to the merge commit where I merged my feature branch with dev.

However, when I do a git blame of FILE-A, the commit is not there, and the line in question is in its original (pre REV-A commit).

Additionally, git show REV-A | patch -p1 results in the patch being applied cleanly. After that, git diff looks the same as git show REV-A.

What's going on? How is it that a merge introduces a revision into the branch history, but doesn't actually apply it? Are there any other changes from that merge which aren't being applied???

解决方案

Do you still have the commands you ran? This would be helpful in tracking down where things may have gone awry. I can't help but think that somehow the feature was not 'finished' correctly. Can you confirm you typed git flow feature finish my_feature?

I have simulated a feature with the commands below, but have not encountered the issue you describe. If your steps deviate from what I have below it would be great to compare how, and where.

MBP:git-test acanby (master)$ echo "Original Code" > file.txt
MBP:git-test acanby (master)$ git commit -am "First commit"
MBP:git-test acanby (master)$ git flow init
MBP:git-test acanby (develop)$ git flow feature start my_feature
MBP:git-test acanby (feature/my_feature)$ echo "New feature here" >> file.txt 
MBP:git-test acanby (feature/my_feature)$ git commit -am "Feature change"
MBP:git-test acanby (feature/my_feature)$ git flow feature finish my_feature
MBP:git-test acanby (develop)$ git blame file.txt 
  ^d96c279 (acanby 2015-02-16 20:36:22 +1100 1) Original Code
  62a38725 (acanby 2015-02-16 20:38:37 +1100 2) New feature here
MBP:git-test acanby (develop)$ git log --oneline
  62a3872 Feature change
  d96c279 First commit

Using these commands I was able to complete a feature using the git-flow workflow.

If you're after more info about the git-flow workflow (and specifically the commands and what they do), there is a great cheat sheet available here.

这篇关于合并后不应用修补程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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