English 中文(简体)
从Gite,从其他两个分支(B和C)设立地方分支机构,然后从A到B,没有C卷
原标题:Git, create local branch (A) from two other branches (B and C) and then merge from A to B without C files
  • 时间:2012-04-24 06:39:41
  •  标签:
  • git

I develop Magento module and I have two repos first is my module and another is Magento itself. I clone my module repo to the directory then add Magento repo as a remote and merge two branches in one local branch called testing. It works fine. But when developing I need both projects (module and Magento) open in editor so I edit code in testing branch and then I need to commit that changes. But I can t just merge testing to module branch because I have Magento files in testing branch which I don t need in module branch.

是否有办法把从测试到模块分行的改动合并起来,而没有Magento分行的档案?

由于我的分支机构重叠其根名录,因此子座和子树干 t的工作,模块不仅仅是马根到分支的一个子环节。

感谢。

问题回答

您是否真的希望将测试部门并入你的模块部门? 尽管Magento案卷在你重新找回之后就已经找到,但所有Magento历史都将与贵模块的分支历史密不可分。 这很可能不是你想要的。

如果你真的想要合并,你可以人工删除贵模块部门不希望的Magento先生的档案,并完成由此产生的合并。 如果人工删除工作太多,你可以使用<代码>git ——n -m1 <unwanted-joint-id>。

较清洁的解决办法是cherry-pick and recreate the test Branch。 您总是将Magento分行并入你的测试处,我假定,在检测中,你没有其他分行。

试验组自与现分处共同保存以来,未合并承诺清单(现分处的复印件):

git rev-list --reverse --first-parent --no-merges ..testing | git cherry-pick --stdin

然后,你可以摆脱旧的测试处,因为它含有不必要的合并,其内容与贵单元的分支内容相同。 您可以再次开始担任你的模块部门。 您的测验处打电话git reset——硬模块——但确保您不会事先作出不寻常的改动,因为他们将失去!





相关问题
git confusion - cloning a repo is returning a past version

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...

热门标签