如何仅从另一个本地分支签出部分文件

How to checkout only part of file from another local branch

假设我有两个本地分支机构 masterslave。在 master 上做了一些工作并提交了更改。

现在我只想包含从 masterslave 的部分文件。

我知道如何包含整个文件。 git checkout `slave` git checkout `master` -- <file>

但这并不能解决我的问题。

git checkout `slave` 
mv file file.slave
git checkout `master` -- <file>
mv file file.master
// now munge file.slave with file.master parts you want