Ric*_*ton 83 git version-control
我想提取一个git存储库中保存的文件的最新版本的副本,并将其传递给脚本进行一些处理.使用svn或hg,我只使用"cat"命令:
按指定的修订版打印指定的文件.如果没有给出修订,则使用工作目录的父级,如果没有签出修订,则提示.
(这是来自hg文档中hg cat的描述)
使用git执行此操作的等效命令是什么?
Tor*_*amo 110
git show rev:path/to/file
Run Code Online (Sandbox Code Playgroud)
当转速是修订.
有关git和svn命令的比较,请参见http://git.or.cz/course/svn.html.
小智 9
有"git cat-file"你可以像这样运行:
$ git cat-file blob v1.0:path/to/file
你可以用你想要的分支,标记或提交SHA替换'v1.0',然后用存储库中的相对路径替换'path/to/file'.如果需要,您还可以传递'-s'以查看内容的大小.
可能更接近你习惯的'猫'命令,虽然前面提到的'show'会做同样的事情.
git 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.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13478 次 |
| 最近记录: |