java - Removing remote Git branch using JGit -
i trying remove remote branch called test. don't errors while running code remote branch not getting removed.
'ans' destination including branch id.
this code worked me when used full branch. must have changed because doesnt work more.
git.branchdelete().setbranchnames(ans).setforce(true).call(); refspec refspec = new refspec() .setsource(null) .setdestination("refs/remotes/origin/test"); git.push().setrefspecs(refspec).setremote("origin").call();
assuming 'ans' full branch name of local branch e.g. refs/heads/test branchdelete() code looks ok.
but destination of ref spec pased push command should denote name of branch referenced on remote end. in case refs/heads/test
refspec refspec = new refspec().setsource( null ).setdestination( "refs/heads/test" ); or in short
refspec refspec = new refspec( ":refs/heads/test" );
Comments
Post a Comment