本文介绍了github:如何在不克隆的情况下从命令行读取日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在不克隆项目的情况下从命令行读取Github上存储库的日志?
How can I read the log of a repository on Github from the command line without cloning the project?
换句话说,如果裸仓库位于文件系统上的某个地方,我可以使用以下命令读取日志:
In other words, if the bare repo is somewhere on my filesystem, I can read the log with:
git -C /media/git-repos/project.git log
如果回购在Github上怎么办?
How do I do it if the repo is on Github?
推荐答案
基于@MarkAdelsberger的答案,这是一个快速的python脚本,用于返回github上git仓库的日志.它需要两个参数,即 user-name 和 repo-name .
Based on @MarkAdelsberger answer, here is a quick python script that returns the log of a git repository on github. It expects two arguments, user-name and repo-name.
#!/usr/bin/python
# github_log.py
import urllib2, json, sys
json_str = urllib2.urlopen("https://api.github.com/repos/{}/{}/commits"
.format(sys.argv[1], sys.argv[2])).read()
commits = json.loads(json_str)
for c in commits:
print c['sha'][0:8],c['commit']['message'].split('\n')[0]
示例
./github_log.py microsoft vscode
返回:
a4ae8375 fix decorations service test
45a71083 :lipstick:
9613370d update title area faster when opening a new group
42e1d19a composite bar polish css classes
8f4e125a Fix compilation errors
3170a7f5 Do not overload getConfiguration for sending it to extension host. Use getConfigurationData
f704a6c7 composite part: move pin / unpin / mode to compositePart
5276a4fc deco - proper explorer update on config change
这篇关于github:如何在不克隆的情况下从命令行读取日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!