简体   繁体   English

在git中打开HEAD和二进制文件的工作目录版本

[英]Open HEAD and working directory versions of a binary file in git

Is it possible to open the original version (HEAD) of a file in git that's been overwritten in the working directory, without resetting the changes? 是否可以在工作目录中打开已被覆盖的git文件的原始版本(HEAD),而无需重置更改? This would be incredibly useful for viewing before and after binary files (like images), where git does not give useful output. 这对于在二进制文件(如图像)之前和之后进行查看非常有用,其中git不会提供有用的输出。

Ideally, it would be possible to open both versions (perhaps the index too), at the same time, so they could be viewed side-by-side. 理想情况下,有可能同时打开两个版本(也许也打开了索引),因此可以并排查看它们。

You could at least copy that binary elsewhere, in order to be able to open it: 您至少可以将该二进制文件复制到其他位置,以便能够打开它:

 git show HEAD:yourBinaryfile > /elsewhere

See " In Git: view a file in a different branch without changing branches " for more on git show . 有关git show更多信息,请参见“ 在Git中:在其他分支中查看文件而不更改分支 ”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM