我想使用类似于:
git checkout -- <path>/<file>
但是我想把文件签出到我选择的某个文件夹中,而不是覆盖本地的<path>/<file>
。
有什么想法吗?
发布于 2013-05-11 12:19:04
另一种更简洁的解决方案--只需指定一个不同的工作树。
要签出从头部(而不是索引)到特定输出目录的所有内容:
git --work-tree=/path/to/outputdir checkout HEAD -- .
要将子目录或文件从头目录签出到特定目录,请执行以下操作:
git --work-tree=/path/to/outputdir checkout HEAD -- subdirname
发布于 2016-09-12 14:44:25
如果你在你的功能下工作,并且不想签回master,你可以运行:
cd ./myrepo
git worktree add ../myrepo_master master
git worktree remove ../myrepo_master
它将使用master
分支提交创建../myrepo_master
目录,您可以在其中继续工作
发布于 2010-12-19 23:28:04
对于单个文件:
git show HEAD:abspath/to/file > file.copy
https://stackoverflow.com/questions/4479960
复制相似问题