diff --git a/src/main/java/org/kohsuke/github/GHBranch.java b/src/main/java/org/kohsuke/github/GHBranch.java index 0f648be857..1db9801eb5 100644 --- a/src/main/java/org/kohsuke/github/GHBranch.java +++ b/src/main/java/org/kohsuke/github/GHBranch.java @@ -202,7 +202,9 @@ public GHCommit merge(String head, String commitMessage) throws IOException { * @see https://docs.github.com/en/rest/branches/branches?apiVersion=2022-11-28#rename-a-branch */ public GHBranch rename(String name) throws IOException { - root().createRequest().method("POST").with("new_name", name).withUrlPath(getApiRoute() + "/rename").send(); + return root().createRequest().method("POST").with("new_name", name) + .withUrlPath(getApiRoute() + "/rename") + .fetch(GHBranch.class); } /**