How to determine with JGit which branches have been merged to master? -
how utilize jgit determine branches have been merged master?
i want equivalent of normal git command:
git branch -a --merged
is possible in jgit?
revwalk#ismergedinto()
can used determine if commit merged another. is, ismergedinto
returns true if commit given in first argument ancestor of sec given commit.
revwalk revwalk = new revwalk( repository ); revcommit masterhead = revwalk.parsecommit( repository.resolve( "refs/heads/master" ); revcommit otherhead = revwalk.parsecommit( repository.resolve( "refs/heads/other-branch" ); if( revwalk.ismergedinto( otherhead, masterhead ) ) { ... } revwalk.release();
to list of branches listbranchescommand
can used:
list<ref> branches = git.wrap( repository ).listbranches().setlistmode( listmode.all ).call();
jgit
No comments:
Post a Comment