You can use git show
with a path from the root of the repository ( ./
or ../
for relative pathing):
(您可以将git show
与来自存储库根目录的路径一起使用( ./
或../
用于相对路径):)
$ git show REVISION:path/to/file
Replace REVISION with your actual revision (could be a Git commit SHA, a tag name, a branch name, a relative commit name, or any other way of identifying a commit in Git)
(将REVISION替换为您的实际修订版(可以是Git提交SHA,标签名称,分支名称,相对提交名称,或在Git中标识提交的任何其他方式))
For example, to view the version of file repository-root/src/main.c
from 4 commits ago, use:
(例如,要从4次提交之前查看文件repository-root/src/main.c
的版本,请使用:)
$ git show HEAD~4:src/main.c
Git for Windows requires forward slashes even in paths relative to the current directory.
(Git for Windows即使在相对于当前目录的路径中也需要正斜杠。)
For more information, check out the man page for git-show
. (有关更多信息,请查看git-show
的手册页。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…