您如何找到谁将git commit合并到分支中? [英] How do you find who merged a git commit into a branch?
问题描述
我们的git存储库中有一个文件正在工作,我想找出是谁将此文件合并到一个分支中.
There is a file in our git repository in work, I want to find out who merged this file into a branch.
我有一个提交哈希,用于标识引入该文件的提交(比如说552a976f1a25f9bad57efb9455e951f6b7b3367f
),而且我知道该文件位于分支staging
上.
I have the commit hash that identifies the commit (lets say 552a976f1a25f9bad57efb9455e951f6b7b3367f
) that introduced the file, and I know that the file is on the branch staging
.
如何找到将上面的提交合并到staging
分支中的提交的哈希?我想找到合并的用户以及合并的日期.
How can I find the hash of the commit that merged the commit above into the staging
branch? I want to find the user who merged, and the date of the merge.
推荐答案
git log <commit-id>..<branch> --ancestry-path --merges --reverse
将为您提供自您感兴趣的<commit-id>
以来发生的合并列表以及<branch>
的当前状态.根据您的合并工作流程,您感兴趣的合并可能是列表中的第一个,也可能是下一个.
will give you the list of merges that happened since the <commit-id>
that you're interested in and the current state of the <branch>
. Depending on your merging workflow, the merge you're interested in may be the first one on the list or one of the next ones.
通过以下方式可视化历史的相关部分将很有帮助
It will be helpful to visualize the relevant part of history with
git log --oneline --graph --decorate --ancestry-path --boundary <commit-id>..<branch>
在图形底部附近查找您的<commit-id>
(它将属于图形边界"-用o
而不是*
标记).
Look for your <commit-id>
near the bottom of the graph (it will belong to "graph boundary" - marked with o
rather than *
).
这篇关于您如何找到谁将git commit合并到分支中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!