Rename a Branch
As a developer, you may need to rename a branch for various reasons, such as to make it more descriptive or to follow a naming convention. Renaming a branch can be a simple task, but it requires some knowledge of Git commands. In this challenge, you will learn how to rename a branch using Git.
Tasks
For this challenge, we will use the Git repository named https://github.com/labex-labs/git-playground
.
Suppose you have created a branch named old-branch
to work on a new feature. After completing the feature, you realize that the branch name is not descriptive enough. You want to rename the branch to new-branch
to make it more meaningful.
To rename the branch, follow these steps:
- Open the terminal and navigate to the local repository directory.
- Rename the branch named
old-branch
to new-branch
.
- Verify that the branch has been renamed.
The output should show the new branch name:
master
* new-branch