A
A
Alex2015-07-11 13:13:50
git
Alex, 2015-07-11 13:13:50

How to change branch name in git?

The question is in the title.
There are two branches:

  • master
  • dec

The second one has a typo. How to change the name of the second branch?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2015-07-11
@Kozack

git branch -m old_branch new_branch         # Rename branch locally    
git push origin :old_branch                 # Delete the old branch    
git push -u origin new_branch   # Push the new branch, set local branch to track the new remote

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question