Git basics

Rename a branch

Give a branch a new name on your machine and on GitHub.

Fill these in once
  1. Rename it on your machine
    Terminal
    git branch -m old-name new-name
  2. Push the new name to GitHub
    Terminal
    git push -u origin new-name
  3. Delete the old name from GitHub
    Terminal
    git push origin --delete old-name

Check it worked

  1. See all branches here and on GitHub
    Terminal
    git branch -a
  1. Rename it on your machine
    Terminal · Ubuntu / Debian
    git branch -m old-name new-name
  2. Push the new name to GitHub
    Terminal · Ubuntu / Debian
    git push -u origin new-name
  3. Delete the old name from GitHub
    Terminal · Ubuntu / Debian
    git push origin --delete old-name

Check it worked

  1. See all branches here and on GitHub
    Terminal · Ubuntu / Debian
    git branch -a
  1. Rename it on your machine
    PowerShell
    git branch -m old-name new-name
  2. Push the new name to GitHub
    PowerShell
    git push -u origin new-name
  3. Delete the old name from GitHub
    PowerShell
    git push origin --delete old-name

Check it worked

  1. See all branches here and on GitHub
    PowerShell
    git branch -a