Git rename local branch – git branch -m oldname newnm – Code Example


In this article we will show you the command to rename local and remote branch of git.

Code Example –

1. Rename local git branch –

git branch -m old-name new-name

2. Rename remote git branch –

2.1 – First delete old branch on remote and then push new-name on local –

git push origin :old-name new-name

2.2 – Reset upstream branch –

git push origin :old-name new-name