Renaming branches in Git
There are cases when we need to rename a branch, but at the same time keep all the history of its changes and commits. For these purposes, we use the branch command with the --move flag, followed by the original and new names separated by a space:
git branch --move old new
Rename the branch in your Git repository.