我的git存储库中有一个二进制文件(foo.bin)。
如何在不覆盖工作副本中的文件的情况下签出此文件的旧版本?
类似的东西:
git checkout tag-name -- foo.bin > foo-tag-name.bin
答案 0 :(得分:4)
你的命令几乎是正确的:
git show tag-name:foo.bin > foo-tag-name.bin
git help show
还举了另一个例子:
git show next~10:Documentation/README
Shows the contents of the file Documentation/README as they were
current in the 10th last commit of the branch next.
git help gitrevisions
:
<rev>:<path>, e.g. HEAD:README, :README, master:./README
A suffix : followed by a path names the blob or tree at the given
path in the tree-ish object named by the part before the colon.
答案 1 :(得分:1)
git show
是您正在寻找的命令:
git show tag-name:foo.bin > foo-tag-name.bin