将不同分支中的文件检出到当前分支中的不同路径中

checkout a file from a different branch into a different path in your current branch

所以我知道我们可以使用 :

从其他分支将文件检出到我们当前的工作分支
git checkout [someOtherBranch] [path/to/file]

我希望这样的事情是可能的:

git checkout [someOtherBranch] [path/to/file] [path/we/want/to/copy/to]

这可能吗?

您可以 cat 文件的内容,然后使用标准 shell 重定向将其放在您想要的任何位置。

git show [someOtherBranch]:path/to/file > newpath/to/file