如何使用 git 从另一个分支打印文件?
How do I print a file from another branch with git?
我知道有 git cat-file
但需要 sha
我想做的是类似 git cat-file mybranch -- path/to/myfile.txt
的事情,它可以完成与
相同的事情
git checkout mybranch && cat path/to/myfile.txt
除非它实际上不会签出分支。我该怎么做?
您可以通过多种方式做到这一点:
git cat-file blob mybranch:path/to/myfile.txt
或
git show mybranch:path/to/myfile.txt
我知道有 git cat-file
但需要 sha
我想做的是类似 git cat-file mybranch -- path/to/myfile.txt
的事情,它可以完成与
git checkout mybranch && cat path/to/myfile.txt
除非它实际上不会签出分支。我该怎么做?
您可以通过多种方式做到这一点:
git cat-file blob mybranch:path/to/myfile.txt
或
git show mybranch:path/to/myfile.txt