0

I'm using gitlab4jto change project default branch from master to dev with Java, I have authenticated changed the default branch but changes not saved

GitLabApi gitLabApi = new GitLabApi("***", "mytoken");
List<Project> projects = gitLabApi.getProjectApi().getProjects();

for (Project project : projects) {
    if(project.getId()==633) {
        project.setDefaultBranch("dev");            
    }
}
Dushyant Tankariya
  • 1,432
  • 3
  • 11
  • 17
helleye12
  • 1
  • 1

1 Answers1

-1

i Hvae resolved this problem by adding :

gitLabApi.getProjectApi().updateProject(project);

so the new code is :

for (Project project : projects) {

        if(project.getId()==633) {
            project.setDefaultBranch("dev");
            gitLabApi.getProjectApi().updateProject(project);

        }

    }
helleye12
  • 1
  • 1