[英]Git Merge subdirectory to branch to root directory of master
I have a branch that has the content of the master branch as a subdirectory. 我有一个分支,该分支具有master分支的内容作为子目录。 Now I made some changes to this subdirectory. 现在,我对该子目录进行了一些更改。 Ideally I want to be able to merge these changes back into the master branch. 理想情况下,我希望能够将这些更改重新合并到master分支中。
Branch layout: 分支机构布局:
index.html
subdirectory
> a.txt
> b.txt
Master layout 主布局
a.txt
b.txt
How would I go about doing this? 我将如何去做呢? Is it even a good approach? 这甚至是个好方法吗? In SVN I avoided merging subdirectories back into the trunk. 在SVN中,我避免将子目录合并回主干。 But this is a somewhat different use case, the layout of both, the branch and master, will never change. 但这是一个稍微不同的用例,分支和主节点的布局都不会改变。
You could try 你可以试试
git branch to_be_merge_to_master
) 从当前分支创建一个分支( git branch to_be_merge_to_master
) git mv ...
) 将文件移回正确的结构( git mv ...
) 利用git子模块
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.