How to rename a local branch in Git?

Asked

Viewed 10,072 times

12

How do I rename my local Git branch?

I don’t want to rename a remote branch, I want a simple way to rename my local branch.

2 answers

22


To rename a branch, you use the following command:

git branch -m <nome antigo do branch> <nome novo do branch>

2

I saw a lot of people with problems, using the <> signals to try to rename the branch... Well, to simplify, let’s say you have a branch called Nfseissonline, but you come across the situation of having to change to Nfsesjp, you will not use the sinhais <>, just type:

git branch -m NfseISSOnline NfseSJP

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

  • Jakson, your reply does not add anything new to the answer already made. I think it would be more interesting as a comment on the answer chosen.

  • 2

    Do you know noobice? I just committed an unintentionally hahaha Sorry, I wanted to answer the question and take a doubt, of which I also had at the beginning, I was thrown in this love boat called git without knowing what to do initially hehehehehe

  • No problem.. hahahaha

Browser other questions tagged

You are not signed in. Login or sign up in order to post.