我为子项目创建了master的my_branch(请参见下图)。我不得不从my_branch中删除很多文件,因为它们与子项目无关,但这些文件仍然在master中需要。有一段时间,开发发生在master和my_branch中。重建或合并Git分支但保留已删除的文件
既然子项目已经完成,我想要将my_branch中的更改重新绑定或合并到master。但我想保留所有在my_branch中删除但仍然存在于master中的文件。最简单的方法是什么?
我意识到我应该已经创建了一个单独的存储库并重构项目。但鉴于目前的情况,我能做些什么,最好不要手动?
不幸的是,我不能假定所有被删除的文件都在单独的提交中。
* 172c3f3 (origin/my_branch, my_branch) comment
| * e4f6849 (origin/master, origin/HEAD, master) Merge branch asdf
| |\
| | * c796e73 aafg
| |/
| * 75720e5 Merge branch zxcv
| |\
| | * 7c694e9 changes
| |/
* | 61370ac some
* | 8afc0be development,
* | d14263b bugfixes,
* | 0d5a17f testing,
* | 588cf8f maybe some cleanup
* | 588cf8f here and there
* | e1f990b and a lot of files
* | 146212b removed
* | 09c6278 but they are still needed in master
|/
* 9a53a83 my_branch created here
这里思考了我的头顶部开始my_branch,然后提交主。将my_branch合并(或重新绑定)为master。然后再次追踪所有文件? – jrahhali