1. git branch -m oldBranchName newBranchName
Modify the local branch name. This will rename the branch in the local repository but will not affect the remote repository.
2. git push origin :oldBranchName
The command is used to delete the old branch in the remote warehouse. By adding the colon : in front of the branch name to the command, an empty reference can be pushed to the remote branch, thereby deleting the branch.
3. git push --set-upstream origin newBranchName
Push the renamed local branch to the remote and associate the local branch with it.
By using the --set-upstream or -u option, Git will automatically set the association between the new branch and the remote warehouse branch;
In this way, in future push operations, you can simply use the git push command to push updates to the local branch without specifying the remote repository and branch name.