JGit retrieve branch on which a commitID was made
问题 When I checkout from a commitID, git goes into a NO_BRANCH detached state. So the JGit APi which I use to get the branch name is returning the commit. So I need to a way, in JGit API, to find the branch on which this commit was made. 回答1: Using the detached-branch mode (i.e. checking out from a commit) is really not recommended: http://sitaramc.github.com/concepts/detached-head.html First of all, I do not know how you get the commit SHA. Usually you find a commit by scanning a branch (using