public Ref createBranchAndCheckout ( Git git , String branch ) { try { return git . checkout ( ) . setCreateBranch ( true ) . setName ( branch ) . setUpstreamMode ( CreateBranchCommand . SetupUpstreamMode . TRACK ) . call ( ) ; } catch ( GitAPIException e ) { throw new IllegalStateException ( e ) ; } }
Executes a checkout - b command using given branch .