There is a file in our git repository in work, I want to find out who merged this file into a branch.
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
.
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.
If I understand you correctly, you have C5, and you are searching for C6. If it's the case, you are probably looking for this:
git rev-list --merges HEAD --not <hash> --reverse
It will give you the list of merge commits which happened after your hash commit. I use HEAD
in this command believing that you are be on master
, in the example, or staging
in your situation.
In a not-too-complex environment you are probably looking for the first merge which happened after your commit... But if you have not this kind of chance, You can try:
git log --graph --decorate HEAD...<hash>^
Or any graphic tool to explore your history (such as gitk
)...