git 如何获得提交到存储库的通知?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9845655/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I get notifications for commits to a repository?
提问by ton.yeung
I'd like to know what kind of commits are being made to the Lithium framework so I can update (or rollback) when there is something major.
我想知道对 Lithium 框架进行了什么样的提交,以便在发生重大事件时进行更新(或回滚)。
I'm already watching the repository, but from what I've been able to find, that only shows updates on the github dashboard.
我已经在查看存储库,但从我能够找到的内容来看,它只显示 github 仪表板上的更新。
采纳答案by Mehdi Lahmam B.
Subscribe to Github's RSS feed!
Choose your news feed (all watched repos), or only Lithium's commit history.
订阅 Github 的 RSS 提要!
选择您的新闻提要(所有观看过的存储库),或仅选择 Lithium 的提交历史记录。
RSS are made for that ;-)
RSS 就是为此而制作的 ;-)
PS: I don't see how can you find that useful since there is a couple of commits made each day on various branches, some small typo fixes, others fix bugs, and others introduce new things...
PS:我不明白你怎么会觉得这很有用,因为每天在不同的分支上都有几次提交,一些小的错字修复,其他的修复错误,还有其他的引入了新的东西......
回答by Justin Workman
回答by Krisztian
I just found out by accident that you can easily manage to achieve this:
我只是偶然发现您可以轻松实现这一目标:
- forkthe project (if you haven't done it yet)
- create a pull request for yourself from the selected branch, e.g. from master of head project to master of your fork:
- base fork: original/project ; base: master ; head fork: your/project ; compare: master
- do NOTmerge this pull request
- under the Email section of your Notificationssettings enable:
- Comments on Issues and Pull Requests
- Pull Request reviews
- Pull Request pushes
- fork项目(如果你还没有做过)
- 从选定的分支为自己创建一个拉取请求,例如从主项目的主人到你的分支的主人:
- 基础叉:原始/项目;基地:大师;头叉:你的/项目;比较:大师
- 千万不要合并这拉动请求
- 在通知设置的电子邮件部分下启用:
- 对问题和拉取请求的评论
- 拉取请求评论
- 拉取请求推送
That's it. You will receive email notifications about every commit on master branch.
就是这样。您将收到有关 master 分支上每次提交的电子邮件通知。
回答by nulltoken
You can leverage the GitHub Events APIto perform such task and retrieve a JSON formatted response.
您可以利用GitHub Events API来执行此类任务并检索 JSON 格式的响应。
- syntax:
GET /repos/:user/:repo/events
- example:https://api.github.com/repos/UnionOfRAD/lithium/events
- 句法:
GET /repos/:user/:repo/events
- 示例:https : //api.github.com/repos/UnionOfRAD/lithium/events
Note:In order to retrieve the commits, you'll have to filter out the events of type PushEvents
.
注意:为了检索提交,您必须过滤掉类型为 的事件PushEvents
。
Below a quick sample
下面是一个快速示例
$(function() {
$.getJSON('https://api.github.com/repos/UnionOfRAD/lithium/events?callback=?', function(data) {
var list = $('#push-events');
$.each(data.data, function(key, val) {
if (val.type == "PushEvent") {
$.each(val.payload.commits, function(key2, val2) {
list.append('<li id="' + val2.sha + '"><a href="https://github.com/UnionOfRAD/lithium/commit/' + val2.sha + '">'
+ val2.message + '</a> [' + val.actor.login + ' @ ' + val.created_at + ']</li>');
});
}
});
if (list.children().size() == 0) {
list.append('<li>No pushes in last ' + data.data.length + ' events.</li>');
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<ul id="push-events"></ul>
回答by Aurelien
Disclaimer: I'm the original author.
免责声明:我是原作者。
This projectallows you to get an e-mail when a commit gets pushed on a repository you are watching (on any branch).
该项目允许您在您正在查看的存储库(在任何分支上)上推送提交时收到电子邮件。
Explaination: gicowais a command-line tool written in python that lists all last commits on all GitHub repos you are watching. This tool can send its output via e-mail and can be called from your crontab
. Doing that makes you receive an e-mail notification each time a commit gets pushed on a GitHub repo you are watching.
说明:gicowa是一个用 python 编写的命令行工具,它列出了您正在观看的所有 GitHub 存储库上的所有最后提交。该工具可以通过电子邮件发送其输出,并且可以从您的crontab
. 这样做会使您每次在您正在观看的 GitHub 存储库上推送提交时都会收到电子邮件通知。
回答by gtamborero
Go to your github project -> Settings -> notifications.
转到您的 github 项目 -> 设置 -> 通知。
Add any address you want to notify when commits are done.
添加您要在提交完成时通知的任何地址。
回答by user4028
You go into Settings > Integrations & servicesfor the GitHub repository and add an Emailservice. See Choosing the types of notifications you receive.
您进入GitHub 存储库的设置 > 集成和服务并添加电子邮件服务。请参阅选择您收到的通知类型。