简体   繁体   English

搜索用户在GitHub存储库中创建的所有分支

[英]Search all branches created by a user in a GitHub repository

There was a branch created by a user ( knownUserName ) in our code repository ( repoEx ). 在我们的代码存储库( repoEx )中有一个由用户( knownUserName )创建的分支。 Where he committed and push ed a few of his changes, but he didn't create a pull request for the same. 他承诺并push了他的一些改变,但他没有创建拉动请求。

It has been long and there is an exponential increase in the number of branches that the repository now has because of which we are unable to go through all the branches and find the one created by him. 它已经很长了,存储库现在拥有的分支数量呈指数增长,因此我们无法遍历所有分支并找到由他创建的分支。

Is there a way to search all the branches using the git command line or GitHub interface, to find all the branches created by a user in a specific repository? 有没有办法使用git命令行或GitHub接口搜索所有分支,以查找用户在特定存储库中创建的所有分支

I tried using the GitHub interface and filtering the branches (under https://github.com/repoEx/branches/all ) using the search parameter as - 我尝试使用GitHub接口并使用搜索参数过滤分支(在https://github.com/repoEx/branches/all下) -

author:<knownUserName>

but this won't work. 但这不行。 The search seems to be effective with a branch name, but I don't have any clue about the name. 搜索似乎对分支名称有效,但我对该名称没有任何线索。

Loop on the branch, display the last commit information, and grep on the username. 在分支上循环,显示最后的提交信息,并在用户名上显示grep。

You will have the commit id you are looking for: 您将拥有您正在寻找的提交ID:

for co in `git branch -a --no-merge`; do  git log -1 --no-walk --pretty=format:"%h - %an, %ar : %s" $co; done | grep <knownUserName>

This is for OS X. Just adding grep on to this answer here and modifying for email, you get 这适用于OS X.只需在此处添加grep 到此答案并修改电子邮件即可

git for-each-ref --format='%(committerdate) %09 %(authoremail) %09 %(refname)' | sort -k5n -k2M -k3n -k4n | grep <author-email>

which works quite well. 哪作得很好。

[Other answer did not work for me, not sure why] [其他答案对我不起作用,不知道为什么]

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

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