获取所有在分支开发之前做出提交的唯一作者
Get all unique authors that have made commits which are ahead of development for a branch
所以我想获得所有编辑过分支的作者。因此,我想获得一份在 x 分支开发之前做出承诺的所有人的列表。
我目前通过
获得了所有提交的列表
git rev-list --left-right origin/development...origin/OtherBranch | grep '>' |cut -c2-
然后对于每个提交我 运行
git show $commitID
并从该结果中解析用户名和电子邮件以获得唯一性 names/emails
我想知道是否有更好的方法来完成这一切,例如我知道我可以直接获取总提交名称 运行ning
git log -n 100 --format=\"%ae, %an\" --no-merges $branchName | sort -u
但这不仅是前面的提交,而且不是唯一的
您可以使用 --ancestry-path
option of git log
1 获取 development
和 OtherBranch
之间的提交列表。
When given a range of commits to display (e.g. commit1..commit2
or commit2 ^commit1
), only display commits that exist directly on the ancestry chain between the commit1
and commit2
, i.e. commits that are both descendants of commit1
, and ancestors of commit2
.
在你的情况下,你会说:
git log --ancestry-path origin/development..origin/OtherBranch
注意 double dot notation 到 select 的使用 无法从 origin/development
访问 但 从 origin/OtherBranch
.
可访问
然后您可以将其与 --format
选项结合使用以仅打印作者的电子邮件和姓名:
git log --ancestry-path --format="%ae, %an" origin/development..origin/OtherBranch
1 您也可以在此处使用 git rev-list
,因为它接受与 git log
.
大部分相同的选项
修复了使用双点和组合命令的问题,如 RomainValeri 所述
结果命令是
git log --format="%ae, %an" --no-merges $targetBranch..$branchName | sort -u
所以我想获得所有编辑过分支的作者。因此,我想获得一份在 x 分支开发之前做出承诺的所有人的列表。
我目前通过
获得了所有提交的列表git rev-list --left-right origin/development...origin/OtherBranch | grep '>' |cut -c2-
然后对于每个提交我 运行
git show $commitID
并从该结果中解析用户名和电子邮件以获得唯一性 names/emails 我想知道是否有更好的方法来完成这一切,例如我知道我可以直接获取总提交名称 运行ning
git log -n 100 --format=\"%ae, %an\" --no-merges $branchName | sort -u
但这不仅是前面的提交,而且不是唯一的
您可以使用 --ancestry-path
option of git log
1 获取 development
和 OtherBranch
之间的提交列表。
When given a range of commits to display (e.g.
commit1..commit2
orcommit2 ^commit1
), only display commits that exist directly on the ancestry chain between thecommit1
andcommit2
, i.e. commits that are both descendants ofcommit1
, and ancestors ofcommit2
.
在你的情况下,你会说:
git log --ancestry-path origin/development..origin/OtherBranch
注意 double dot notation 到 select 的使用 无法从 origin/development
访问 但 从 origin/OtherBranch
.
然后您可以将其与 --format
选项结合使用以仅打印作者的电子邮件和姓名:
git log --ancestry-path --format="%ae, %an" origin/development..origin/OtherBranch
1 您也可以在此处使用 git rev-list
,因为它接受与 git log
.
修复了使用双点和组合命令的问题,如 RomainValeri 所述
结果命令是
git log --format="%ae, %an" --no-merges $targetBranch..$branchName | sort -u