[英]How do I print a file from another branch with git?
I know there's git cat-file
but it takes a sha
我知道有
git cat-file
但它需要一个sha
what I want to do is something like git cat-file mybranch -- path/to/myfile.txt
which would accomplish the same thing as我想做的是
git cat-file mybranch -- path/to/myfile.txt
之类的东西,它可以完成与
git checkout mybranch && cat path/to/myfile.txt
except it wouldn't actually checkout the branch.除非它实际上不会结帐分支。 How can I do this?
我怎样才能做到这一点?
You can do it in many ways:您可以通过多种方式做到这一点:
git cat-file blob mybranch:path/to/myfile.txt
or或者
git show mybranch:path/to/myfile.txt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.