How to rename a local branch in Git?

11

How do I rename my local Git branch?

I do not want to rename a remote branch, I want a simple way to rename my local branch.

    
asked by anonymous 19.08.2014 / 17:18

2 answers

19

To rename a branch, you use the following command:

git branch -m <nome antigo do branch> <nome novo do branch>
    
19.08.2014 / 17:22
2

I saw a lot of people with problems using the < > to try renaming the branch ... Well, for simplicity, let's say you have a branch called NfseISSOnline, but you are faced with the situation of having to change to NfseSJP, you will not use the syntax < & gt ;, just type:

git branch -m NfseISSOnline NfseSJP

First the branch to be changed and then the name of the new branch.

    
27.09.2018 / 15:03