简体   繁体   English

没有本地克隆的远程存储库上的git操作

[英]git operations on remote repository without local clone

What kind of read-only operations are possible on a remote git repository using the standard git command line tool without having a local clone? 在没有本地克隆的情况下,使用标准git命令行工具在远程git存储库上可以进行哪些只读操作?

  • Is there some way to list refs (in particular tags and branches) on the remote repo? 有没有办法在远程仓库上列出refs(特别是标签和分支)?
  • Is there a way to list the content of a given directory in a given revision? 有没有办法列出给定修订中给定目录的内容?
  • Is it possible to retrieve the content of a given file at a given revision? 是否可以在给定的修订版本中检索给定文件的内容?

I guess that doing this without a local clone might involve some low level primitive operations, and I guess that making this usable might best be accomplished by some short shell script. 我想在没有本地克隆的情况下这样做可能会涉及一些低级基本操作,我想这可以通过一些简短的shell脚本来实现。 That would still be within the scope of this question. 这仍然属于这个问题的范围。

Is there some way to list refs (in particular tags and branches) on the remote repo? 有没有办法在远程仓库上列出refs(特别是标签和分支)?

Yes, that is what git ls-remote does. 是的,这就是git ls-remote所做的。

Is there a way to list the content of a given directory in a given revision? 有没有办法列出给定修订中给定目录的内容?
Is it possible to retrieve the content of a given file at a given revision? 是否可以在给定的修订版本中检索给定文件的内容?

2012: However, beside getting branches and tags, I don't think you can get the content without cloning ( full clone or sparse checkout or shallow clone ). 2012:然而,除了获得分支和标签之外,我认为你不能在没有克隆的情况下获得内容( 完全克隆稀疏结账浅层克隆 )。
And you cannot do a shallow clone for a specific commit or tag , or for a specific branch 并且您不能为特定提交或标记特定分支执行浅层克隆 .

Update 2016: 2016年更新:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM