从重命名的文件返回更改 [英] Backport changes from renamed file

查看:112
本文介绍了从重命名的文件返回更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个分支:树干,生产。我在后备箱中发现了一个问题,修理并确认了它,将其推出。现在已经过测试,我需要将更改合并到生产分支中作为热修复。我尝试使用樱桃挑选。然而,它不起作用,因为在我不希望投入生产的某些重构过程中,修复程序中的更改文件在主干中更名。



我不想合并一切,但只采取这个提交。樱桃选择失败并且被我们删除冲突(当然,新文件从未在生产分支中存在)。



什么是正确的方式更改为旧文件?

解决方案



  git show COMMIT_ID  -  old / file / name.txt | patch new / file / name.txt 


I have two branches: trunk, production. I have found a problem in trunk, made fix and committed it, pushed it. Now it was tested and I need do merge changes into the production branch as a hot-fix. I try to use the cherry-pick. However it doesn't work because a changed file(s) in the fix was renamed in the trunk earlier during some refactoring which I don't want bring into production.

I don't want merge everything, but take only this commit. The cherry pick fails with "deleted by us" conflict (of course, the new file never even existed in the production branch).

What is the correct way to bring the changes into the old file?

解决方案

I'd use good old patch for this:

git show COMMIT_ID -- old/file/name.txt | patch new/file/name.txt

这篇关于从重命名的文件返回更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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