问题描述
我读到可以从Git中的特定版本检索单个文件,就像在这个SO问题中回答的那样:
所以我想知道用二进制文件做这件事是否安全。我有一些正在使用的二进制文件,我不想检查它们,我真正想做的是将它们从特定修订版本中复制出来。我试过这个:
git show HEAD〜1:database.db>数据库副本从mmddyy.db
这似乎工作,因为在输出中该提交的database.db完全匹配。但我不知道这是允许使用 git show
?它支持我在做什么,并且结果始终是正确的并且不会损坏(例如,autocrlf翻译,例如..我在Windows msysgit中)。谢谢!
是的,完全安全。从> git help show
:
测试说同样的事情:没有应用属性。 / p>
I read that it's possible to retrieve a single file from a specific revision in Git, as answered in this SO question:
How to retrieve a single file from specific revision in Git?
So I want to know if it's safe to do that with binary files. I have some binary files in use and I don't want to check them out, really what I want to do is copy them out from a specific revision. I tried this:
git show HEAD~1:database.db > copy-of-database-from-mmddyy.db
That seems to work, as in the output is an exact match of database.db for that commit. But I have to wonder is this an allowed use of git show
? Does it support what I'm doing and will the result always be correct and not corrupt (ie autocrlf translation for example.. I'm in Windows msysgit). Thanks!
Yep, perfectly safe. From git help show
:
And testing says the same thing: no attributes are applied.
这篇关于git - 当输出重定向到文件时,git show可以安全地用于二进制文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!