I'm trying to know how I can get the branch in which a commit was created in (not the head). I know a branch is just a 'tag' attached to a commit (the head of that branch)
For example, in this image, what would I need to do to get the branch of the node E using nodegit or another git library.
I looked in the documentation, but I didn't find an equivalent to git branch --contains
Thanks !
You'd have to:
NodeGit.Merge.base(repository, branchTip, interestedCommit)
. returnedCommit === interestedCommit
then you're fine
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.