susanahernandezd
7/26/2016 - 11:14 AM

rename_branch

git branch -m my-hot-feature feature-15

Then, you want to change the remote branch. This is a bit more complex, because you can't directly rename the remote branch. Instead you have to delete the remote branch with the old name, and recreate it with the new name. You need to start by getting the remote name:

git remote -v

This should give you something like this:

origin https://github.com/benjaminlhaas/Yii-with-Users-and-Rights (fetch)
origin https://github.com/benjaminlhaas/Yii-with-Users-and-Rights (push)

The remote name here is "origin." So now that you know this, you can delete and re-create the remote branches.

Delete the remote branch with the old name:
git push origin :my-hot-feature

Re-create the remote branch with the new name:
git push origin feature-15