git-branch - git branching strategy - How do I rename a local Git branch?

git create new branch / git / version-control

I don't want to rename a remote branch, as described in Rename master branch for both local and remote Git repositories.

Sazzad Hissain Khan



Answer #1

Advanced Git users can rename manually using:

Rename the old branch under .git/refs/heads to the new name

Rename the old branch under .git/logs/refs/heads to the new name

Update the .git/HEAD to point to yout new branch name