如何在不首先创建克隆的情况下查看远程Git存储库的最新提交? [英] How do I view the latest commits of a remote Git repository without making a clone first?
问题描述
我想要获取某个远程Git存储库上最新的提交列表。但是,我不想创建一个克隆,因为这需要很长时间。
I want to get a list of the latest commits on a certain remote Git repository. However, I do not want to create a clone because that takes too long.
使用SVN,我可以简单地传递用户名和密码。有了Git,我还没有找到一个选择来做到这一点。此外,是否有像SVN一样的XML输出选项?
With SVN, I can simply pass along a username and password. With Git I haven't found an option to do this. Also, is there an XML output option like with SVN?
推荐答案
这可能不是您想要的,但您可以创建使用 - 深度
选项的浅克隆 git clone
。这只克隆了最后的 n 版本。尽管如此,它仍然会复制所有内容。
This is probably not exactly what you want, but you could create a shallow clone using the --depth
option to git clone
. That clones only the last n revisions. It still copies all the content, though.
对于类似于XML的格式,您可以使用 custom log format 像这样:
For XML-like formatting you could use a custom log format like this:
git log --pretty=format:'<commit><author>%ae</author><subject>%s</subject></commit>'
这篇关于如何在不首先创建克隆的情况下查看远程Git存储库的最新提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!