All fixes

Help, I gave my branch the wrong name

Rename a branch locally, and on the remote too if you already pushed it.

The fix

  1. git branch -m feature/login

    Renames the branch you are on. For another branch: git branch -m old-name new-name.

feature/login is an example. Replace it with your own.

What happens to your historygit branch -m feature/login
BeforeABCmainHEADfeature/lgoin
AfterABCmainHEADfeature/login

Why this works

Renaming only changes the label. Commits and history stay the same. On the remote there is no rename, so you push the new name and delete the old one. The -u matters: after the rename, the branch still tracks the old remote name, and plain git push would refuse until you point it at the new one.