移动文件/目录,但仍然可以轻松合并更改? [英] Move a file/directory but still merge changes easily?

查看:124
本文介绍了移动文件/目录,但仍然可以轻松合并更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读过各种常见问题, git 没有明确地跟踪重命名/移动,宁愿寻找相同的文件(或在某些情况下类似的文件)。这很好,但它能应付这种情况:朋友的远程存储库有一个新特性(i18n),涉及 debian / po / *。po 中的一些新文件。我有我自己的这个项目的分支,并且想要合并这个特性,但是把这些文件放在 po / *。po 中(我可以做两个提交,是必要的)。我期望远程回购将继续接收该功能的更新,并且我想合并/樱桃挑选这些提交并将它们应用于我的新位置中的文件。可以 git 这样做,可能是通过某种这些文件现在移到这里的映射?或者它比它的价值更痛苦,我应该接受我的回购中有点奇怪的 debian 路径?

解决方案

使用 git mv 并且所有内容都将是AOK。为什么不只是试试而不是问?您可以随时在git中轻松重置。 :)

I've read in various FAQs that git doesn't explicitly track renames/moves, preferring to look for identical (or in some situations similar?) files. That's great, but will it cope with this situation: a friend's remote repository has a new feature (i18n) involving some new files at debian/po/*.po. I have my own fork of this project, and want to merge this feature but put the files at just po/*.po (I can do that as two commits, or whatever is necessary). I expect the remote repo will continue to receive updates to the feature, and I want to just merge/cherry-pick those commits and have them applied to the files in my new location. Can git do that, perhaps with some sort of mapping of "these files have moved over here now"? Or is it more pain than it's worth and should I just accept the slightly odd debian path in my repo?

解决方案

use git mv and everything will be AOK.

Why not just try it instead of asking? You can always reset easily in git. :)

这篇关于移动文件/目录,但仍然可以轻松合并更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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