Show the original branch for a commit

后端 未结 9 2225
野的像风
野的像风 2020-12-05 04:14

I\'ve used git-blame to find a particular commit. Now I want to find the branch that it originally came from. (From there, I\'ll use the branch name to find the particular t

9条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-05 05:07

    That isn't really applicable in git. Branches are local concepts to each repository: one person's "local-stuff" branch can be quite separate from another person's "local-stuff" branch. If you do something like looking at your main integration branch, and your query commit, and removing all the merge bases between the two, you should be able to get a subtree of the commit history that may shed some illumination... or may not. e.g. if you trace up the link from the query commit towards "master" you should hopefully find merge commits with useful comments saying where the merge came from... but this information is just informational, not recorded in some way intended to be automatically retrieved.

    e.g. gitk some-commit...master (which is almost short for gitk some-commit master --not $(git merge-base some-commit master))

提交回复
热议问题