If you haven’t pushed your local branch to a remote branch in Git and you would like to rename your current local branch, you should proceed as follows :
Run the command:
git branch -m <newbranchname> [git rename current branch command]
Where -m refers to “move” operation.
Read: How to Delete a Git Branch Locally and Remotely
If you are on a a case-insensitive file system like Windows, you would need to use -M as follows:
git branch -M <newname>
Answer due to Siride
If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.