我想使用类似的东西:
git checkout -- <path>/<file>但我想将文件检出到我选择的某个文件夹,而不是覆盖本地/。
任何想法?
I want to use something similar to:
git checkout -- <path>/<file>but I want to checkout the file to some folder I choose, rather than the overwriting the local <path>/<file>.
Any idea?
最满意答案
根据“git export”(如“svn export”)?
您可以使用git checkout-index ,这是一个低级别命令,如果要导出所有内容,可以使用-a ,
git checkout-index -a -f --prefix=/destination/path/引用手册页:
最后的“/”[前缀]很重要。 导出的名称字面上只是指定字符串的前缀。
如果要导出某个目录,则会有一些技巧。 该命令只需要文件,而不是目录。 要将其应用于目录,请使用'find'命令并将输出管道输出到git。
find dirname -print0 | git checkout-index --prefix=/path-to/dest/ -f -z --stdin还从手册页:
直觉不是这里的目标。 重复性是。
As per Do a "git export" (like "svn export")?
You can use git checkout-index for that, this is a low level command, if you want to export everything, you can use -a,
git checkout-index -a -f --prefix=/destination/path/To quote the man pages:
The final "/" [on the prefix] is important. The exported name is literally just prefixed with the specified string.
If you want to export a certain directory, there are some tricks involved. The command only takes files, not directories. To apply it to directories, use the 'find' command and pipe the output to git.
find dirname -print0 | git checkout-index --prefix=/path-to/dest/ -f -z --stdinAlso from the man pages:
Intuitiveness is not the goal here. Repeatability is.
更多推荐
发布评论