简体   繁体   English

来自请求请求的Git提交消息

[英]Git commit messages from pull request

How to get git commit message from a pull request, may be the request has more than one commits, how can I get these messages. 如何从请求请求中获取git commit消息,可能是该请求具有多个提交,如何获取这些消息。 I know the command git log to get commit message, but I just want to show the relevant commit record for this pull request. 我知道命令git log来获取提交消息,但是我只想显示此请求的相关提交记录。

Most code hosting platforms provide pull requests as a specially named ref. 大多数代码托管平台都将拉取请求作为特殊命名的ref提供。 For example, on GitHub, pull requests are named pull/ID/head , where ID is the pull request number. 例如,在GitHub上,拉取请求被命名为pull/ID/head ,其中ID是拉取请求号。

So if the main repository is named origin , you can check out the branch for pull request 123 by running git fetch origin pull/123/head:pr-123 , which would create the branch pr-123 . 因此,如果主存储库命名为origin ,则可以通过运行git fetch origin pull/123/head:pr-123来签出拉取请求123的分支,这将创建分支pr-123 You can then run git log on it as normal. 然后可以正常运行git log

If you're using GitLab or Bitbucket, they have similar configurations, but the names of the refs differ. 如果您使用的是GitLab或Bitbucket,它们的配置类似,但是引用的名称不同。 You can consult the documentation for the platform you're using to see which refs they use. 您可以查阅所用平台的文档,以了解它们使用的引用。

Of course, these platforms also provide web interfaces you can use if you like. 当然,这些平台还提供您可以使用的Web界面。

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

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