1

I'm trying to acquire information about the branch on which change was pushed.

Let's say I pushed a change with commit hash 1234df on branch some_feature.

It got merged to the master branch and all the other branches.
Later on, I would like to get information on which branch has the given commit which was pushed, not about all branches which already merged this change to themself, but the first one, in this case, some_feature.

git name-rev 1234df

will return tag, not the name of the branch.

Is this possible?

  • Check if this is useful https://stackoverflow.com/questions/2706797/finding-what-branch-a-git-commit-came-from – cauchy Feb 12 '20 at 08:28
  • In general, it is not possible. Commits do not record the branch name that was the current branch at the time the commit was made. (You can put this into the commit message, if you want it, but *you* have to do that.) – torek Feb 12 '20 at 08:56
  • @cauchy Change wasn't pushed in same repository, so reflog won't work. git branch --contains will just list all branches, not solving problem. git log --merges will do pretty the same. Seems like indeed you have to provide this info in description by yourself. – Jakub Jabłoński Feb 12 '20 at 10:19

0 Answers0