Quick summary
Renaming a Git branch in GitLab requires a few simple terminal commands that let you update the branch name locally without losing any history or work.
Steps
- Check the existing branches in your repository before making any changes.
- Type the command git branch and press Enter to list all local branches.
- Alternatively, type git branch --list and press Enter to display all branches.
- Identify the current branch by looking for the entry marked with a star icon (*).
- Type the command git branch -m followed by the new branch name (for example, feature-B) and press Enter.
- Confirm the branch name has been updated by checking the terminal prompt, which now reflects the new name.
- Type git branch again and press Enter to officially verify the new branch name is active.
.gif)



