Tagged as: git linux

Git allows you to change the names of both local and remote branches, with a simple command.

To rename a git branch on your local repository, simply run this command:

git branch -m <old_branch> <new_branch>

Where <old_branch> and <new_branch> represent the old and new branch names respectively.

By default, git will not change the name of any linked branches on other remotes, for example origin. It you wanted to move the branch to a new name on the remote, you need to use a special push command:

git push <new_branch>:<old_branch>