Gitflow
🏷️Rename a Pushed BranchEasy+350 XP
Workshop
Scenario reference

Rename a Pushed Branch: the situation, step by step

The situation

Your branch is `feat-stuff`. Team convention is `feature/<ticket>-description`. You already pushed.

Rename locally, delete the old remote branch, push the new name.

Easy · 3 steps · +350 XP

What you will practice

This scenario walks through 3 steps, in order:

  1. 01Rename the local branch
  2. 02Delete the old remote branch
  3. 03Push the renamed branch with upstream
Reveal the step-by-step commands

Try the terminal first — you learn more by doing. When you want to check yourself, here is the command for each step.

  1. 1. Rename the local branch
    git branch -m feature/ABC-123-stuff
  2. 2. Delete the old remote branch
    git push origin --delete feat-stuff
  3. 3. Push the renamed branch with upstream
    git push -u origin feature/ABC-123-stuff

Key takeaway

Three steps: local rename, delete old remote, push new with -u.