如何在命令行中查看本地服务器中的 git pull 请求?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39997284/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:20:50  来源:igfitidea点击:

How to view git pull requests in a local server, in command line?

gitpull-requestpull

提问by Alexandru

I'm running a local git server, and I'm just wondering, is there a way to see all the pull-requests made by developers? Similar to Github or Bitbucket but in command line.

我正在运行本地 git 服务器,我只是想知道,有没有办法查看开发人员发出的所有拉取请求?类似于 Github 或 Bitbucket,但在命令行中。

Thanks

谢谢

https://git-scm.com/docs/git-request-pull

https://git-scm.com/docs/git-request-pull

回答by Marqin

git-request-pulldoesn't send anything. It just prints to your terminal a text, that can be e-mailed to upstream repository owner.

git-request-pull不发送任何东西。它只是将文本打印到您的终端,该文本可以通过电子邮件发送给上游存储库所有者。

As written in docs:

正如文档中所写:

The request, printed to the standard output, begins with the branch description, summarizes the changes and indicates from where they can be pulled.

打印到标准输出的请求以分支描述开始,总结更改并指示可以从何处提取它们。

And in Git Book:

Git Book 中

you can run the git request-pullcommand and email the output to the project maintainer manually

您可以运行该git request-pull命令并将输出通过电子邮件手动发送给项目维护人员

Example from that book:

那本书的例子:

$ git request-pull origin/master myfork
The following changes since commit 1edee6b1d61823a2de3b09c160d7080b8d1b3a40:
  John Smith (1):
        added a new function

are available in the git repository at:

  git://githost/simplegit.git featureA

Jessica Smith (2):
      add limit to log function
      change log output to 30 from 25

 lib/simplegit.rb |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

回答by firekhaya

This small configuration change may help you achieve what you want.

1. Add the following line to your .git/config file fetch = +refs/pull/*/head:refs/remotes/origin/pr/*

2. Fetch all pull requests using : $ git fetch origin

3. To checkout a particular PR run : $ git checkout pr/999

这个小的配置更改可能会帮助您实现您想要的。

1. 将以下行添加到您的 .git/config 文件fetch = +refs/pull/*/head:refs/remotes/origin/pr/*

2. 使用以下命令 获取所有拉取请求:$ git fetch origin

3. 签出特定的 PR 运行: $ git checkout pr/999

There is a concise guide here

有一个简明指南这里

回答by AFR

You have lot of tools to view your git server statistics.

你有很多工具来查看你的 git 服务器统计信息。

gitinspectorfor example is one of them. There are lot more where you can see statistics in a nice way.

例如gitinspector就是其中之一。还有很多地方可以很好地查看统计数据。

There is a command for console which allows you to check commits by author. check this,

有一个控制台命令,它允许您检查作者的提交。检查这个,

git shortlog -s -n 

回答by Freelancer

Run this command to see all the pull request made by developers:

运行此命令以查看开发人员发出的所有拉取请求:

git shortlog -n

after running the command keep pressing enter to log the complete details.

运行该命令后,继续按 Enter 以记录完整的详细信息。

回答by kolukuri

All the above answers suggested modifying the .git/config file. If you don't want to change the git config file to list all the Pull requests you can use the following command

以上所有答案都建议修改 .git/config 文件。如果您不想更改 git 配置文件以列出所有拉取请求,可以使用以下命令

git fetch origin +refs/pull/*/head:refs/remotes/origin/pr/*