有没有快速的git命令来查看旧版本的文件? [英] Is there a quick git command to see an old version of a file?

查看:532
本文介绍了有没有快速的git命令来查看旧版本的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在git中是否有一个命令可以查看(转储到标准输出或在 $ PAGER $ EDITOR )特定版本的特定文件?

解决方案

您可以使用 git show

$ $ p $ $ git show REVISION:path / to / file
src / main.c
的版本,请使用:

  $ git show HEAD〜4:src / main.c 

请注意,路径是从存储库的根目录开始的,除非以./或../开头以指示相对路径。有关更多信息,请查看 git-show


Is there a command in git to see (either dumped to stdout, or in $PAGER or $EDITOR) a particular version of a particular file?

解决方案

You can use git show:

$ git show REVISION:path/to/file

For example, to view the version of file src/main.c from 4 commits ago, use:

$ git show HEAD~4:src/main.c

Note that the path is from the root of the repository unless it starts with ./ or ../ to indicate a relative path. For more information, check out the man page for git-show.

这篇关于有没有快速的git命令来查看旧版本的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆